1

I tried to download google api using composer to a legacy code but, the following error appeared:

composer require google/apiclient:^2.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for google/apiclient 2.0 -> satisfiable by google/apiclient[v2.0.0].
    - google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
    - Conclusion: don't install guzzlehttp/psr7 1.4.2
    - google/auth v0.8 requires guzzlehttp/psr7 1.2.* -> satisfiable by guzzlehttp/psr7[1.2.0, 1.2.1, 1.2.2, 1.2.3].
    - Can only install one of: guzzlehttp/psr7[1.2.0, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.1, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.2, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.3, 1.4.2].
    - Installation request for guzzlehttp/psr7 (locked at 1.4.2) -> satisfiable by guzzlehttp/psr7[1.4.2].


Installation failed, reverting ./composer.json to its original content.

What should I do?

Logos
  • 334
  • 1
  • 7
  • 17

3 Answers3

1

Try removing vendor/google and then run composer install again, this worked for me.

sc0rp10n.my7h
  • 341
  • 3
  • 15
0

Can only install one of: guzzlehttp/psr7[1.2.3, 1.4.2].

Your dependencies led to confusion of two different major versions of the package, but only one can be installed.

The locked at 1.4.2 message means this package has been already installed as per your composer.lock file, and you're trying to install different version not compatible with your existing criteria.

$ composer show -a google/auth | grep psr7
guzzlehttp/psr7 ~1.2

You can check which existing package depends on the locked version by checking the dependency tree:

composer show -t

In some cases, removing composer.lock may help.

Otherwise, to see why (from where) the package is referenced, run:

composer why guzzlehttp/psr7 -t

See also: How to resolve a "Can only install one of:" conflict?

kenorb
  • 155,785
  • 88
  • 678
  • 743
0

I finally found a solution for me, it works just removing composer.lock!!

Fischer Tirado
  • 321
  • 3
  • 5