I have installed one package via Composer and it installed Guzzlehttp too, because of the package. After that I tried to install another package via Composer, which requires Guzzlehttp too and Composer, tried to install it again.
But I get that error :
Problem 1
Can only install one of: guzzlehttp/guzzle[6.2.0, 6.0.2].
Can only install one of: guzzlehttp/guzzle[6.0.2, 6.2.0].
Can only install one of: guzzlehttp/guzzle[6.0.2, 6.2.0].
I see what is the problem, but I do not know how to fix it.
The "Can only install one [x, y]" message appears when two different packages point to the same dependency, but different major, mutually exclusive versions where only one can be installed.
Troubleshooting
For example, one version can be "locked at" due to the information present in your
composer.lock
file which may conflict with what you're trying to install. In this case, when the confusion error comes with "locked at x.y.z" message, you may use the following commands to understand the existing dependencies of installed packages:Note:
-t
shows as a nested tree view, drop it to see the flat list.To see where the problematic package is referenced from in your project, run:
Note:
-t
shows as a nested tree view, drop it to see the flat list.To see the details of the package which you're trying to install, you may run:
Note: To inspect the specific version, add
x.y.z
, e.g.:composer show -a guzzlehttp/guzzle 6.2.0
To further troubleshoot the problem, depending on your situation, you can try to:
Update the existing packages with dependencies via:
Upgrade or remove conflicting dependencies from your
composer.json
(keep it simple).composer why org/package
to see where the package is referenced (or check the content ofcomposer.lock
manually by looking forx.y.z
). If won't help, consider removingcomposer.lock
and re-try again;composer.json
from the different folder, selectn
.composer.json
, simplified configuration on the empty folder.composer diagnose
to check for any common error.-v
/-vv
/-vvv
to increase the verbosity of your commands.I had a similar issue and I just had to run
composer update
before installing the new package. This will work depending on whether the other installed packages have updated their dependencies too though.