How to find and treat the cause of an outdated composer package that is not in my composer.json? - composer-php

I ran composer outdated command:
$ composer outdated
phpdocumentor/type-resolver 0.4.0 0.7.1
but looking inside composer.json, I see no such package. In my case there is no type-resolver.
How do I find an outdated package that is missing in composer.json belongs to and how do I update it?

Composer install not only packages that are listed directly in composer.json but also packages that are dependencies of packages that are listed in composer.json. Assuming you have in composer package vendor/A and this package requires vendor/B you will have installed both A and B packages.
So in your case you can run:
composer update phpdocumentor/type-resolver
to try to update this package.
Of course it does not mean it will be possible to update this way. It's possible that you might need to run:
composer update
but this will update all packages (and depends on scenario this is what you can accept or maybe you don't want to update all packages).
It's also possible that it won't be possible to update this package because other package that is used has phpdocumentor/type-resolver dependency set to for example 0.4.* so 0.7 version is not compatible with this package and version 0.7 won't be installed

Related

I install the flutterwave package in laravel 8 and 9 but facing this issue

i run this command
composer install flutterwavedev/flutterwave-v3
give me this error.
Invalid argument flutterwavedev/flutterwave-v3. Use "composer require flutterwavedev/flutterwave-v3" instead to add packages to your composer.json.
when we run this command "composer require flutterwavedev/flutterwave-v3".
Your requirements could not be resolved to an installable set of packages.
Problem 1
- flutterwavedev/flutterwave-v3 1.0.0 requires monolog/monolog 1.* -> found monolog/monolog[1.0.0-RC1, ..., 1.x-dev] but the package is fixed to 2.6.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- flutterwavedev/flutterwave-v3 1.0.1 requires vlucas/phpdotenv ^2.5 -> found vlucas/phpdotenv[v2.5.0, ..., 2.6.x-dev] but the package is fixed to v5.4.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires flutterwavedev/flutterwave-v3 ^1.0 -> satisfiable by flutterwavedev/flutterwave-v3[1.0.0, 1.0.1].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require flutterwavedev/flutterwave-v3:*" to figure out if any version is installable, or "composer require flutterwavedev/flutterwave-v3:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
I think currently flutter wave isn't compatible with Laravel 9 yet.

Issue when installing composer on Ubuntu server

I Want to install laravel app and I user composer like this to install packages
composer install
And I get this error
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/dbal 3.3.5 -> satisfiable by doctrine/dbal[3.3.5].
- doctrine/dbal 3.3.5 requires composer-runtime-api ^2 -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I search any solution on the web without succes.
I'm on ubuntu server 20.04
Thank you
you have to upgrade the composer to version ^2.
run this command before "composer install"
=> composer self-update --2

Why is Composer installing an old version when it isn't specified?

When I do:
composer require deployer/deployer
I get the following output:
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.3 for deployer/deployer
./composer.json has been updated
Running composer update deployer/deployer
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- deployer/deployer[v4.3.0, ..., 4.x-dev] require monolog/monolog ^1.21 -> found monolog/monolog[1.21
.0, ..., 1.x-dev] but the package is fixed to 2.3.5 (lock file version) by a partial update and that vers
ion does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires deployer/deployer ^4.3 -> satisfiable by deployer/deployer[v4.3.0, ...,
4.x-dev].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
deployer/deployer is not in the project's composer.json or composer.lock, so what could possibly be requring the relatively ancient version of the package that doesn't seem to be supported by any other package in my Laravel 8 project?
Since you're using PHP 8, 4.3 is the latest version of deployer/deployer that composer has determined to be compatible with your PHP version and minimum stability requirement.
v7 has no stable release yet, but it is the version you need to use with PHP 8.
You can use the release candidate with composer require deployer/deployer:^7.0#RC, or if you set "minimum-stability": "RC" in your composer.json, then composer require deployer/deployer should install it.
v6 requires "php": "^7.2".
I believe this is equivalent to >=7.2 <8.0.0, according to the composer manual.
v5 requires "php": "~7.0" (meaning >=7.0 <8.0)
v4 requires "php": ">=5.6.0" (meaning anything above 5.6.0)
This old version is the one you're getting because it's the only version composer can attempt to install due to the constraints I mentioned above. I don't know if it really is compatible with PHP 8, but I doubt it.

Laravel/nexmo conflict with elasticsearch/elasticsearch your requirements or minimum-stability

I am trying to install nexmo/laravel on my project I am getting this error
The requested package elasticsearch/elasticsearch (locked at v7.3.0, required as 7.0.2) is satisfiable by elasticsearch/elasticsearch[v7.3.0] but these conflict with your requirements or minimum-stability.
I can't downgrade elasticsearch because it will create issue in the project.How i can fix this issue and install this package.
locked at v7.3.0, required as 7.0.2 sounds as if your composer.lock and composer.json files are out of sync. Try deleting composer.lock and your vendor/ directory (if it exists), and do composer install.
If that works, update your composer.json to require the correct version of Elasticsearch you need. composer update elasticsearch/elasticsearch:^7.3 should probably work to do that.
I have fixed the issue with by matching composer.json and composer.lock elasticsearch version.I have change 7.3.0 in composer.lock to 7.0.2 and try to install nexmo package and it installed successfully.

Cannot remove package phpoffice/phpword. (laravel 5.2)

I've been working on a Laravel project. While I'm trying to install some package. I got warned
Package phpoffice/phpexcel is abandoned, you should avoid using it.
Use phpoffice/phpspreadsheet instead.
Therefore, I executed the command
composer remove phpoffice/phpexcel
The phpoffice/phpexcel has been remove from composer.json successfully.
Then install the package,
composer require phpoffice/phpspreadsheet
I still got warned by the same warning,
Package phpoffice/phpexcel is abandoned, you should avoid using it.
Use phpoffice/phpspreadsheet instead.
I always got warned by this sentence from every composer command even the phpoffice/phpexcel has been removed from composer.json.
Pls help I really have no idea to remove this warning.
Maybe the package phpoffice/phpexcel is used by another package in your composer.json. To see if that's the case you can use the following command to find out which other packages may need phpoffice/phpexcel:
composer why phpoffice/phpexcel
Does that give you a list of packages or an error?
To avoid this error you can run the following commands --
composer remove phpoffice/phpexcel
Then -
composer require phpoffice/phpspreadsheet
Then -
composer dump-autoload
composer update

Resources