elize
elize

Reputation: 425

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

I try install https://github.com/google/google-api-php-client for my php project via composer.

composer.json:

{
    "require": {
        "Intervention/image": "~2.3.7",
        "intervention/image": "^2.3",
        "guzzlehttp/guzzle": "^6.2" 
    }
}

I run this command:

composer require google/apiclient:^2.0

And result:

./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
    - google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
    - Installation request for google/apiclient 2.0 -> satisfiable by google/apiclient[v2.0.0].
    - Conclusion: remove guzzlehttp/psr7 1.3.0
    - Conclusion: don't install guzzlehttp/psr7 1.3.0
    - 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.3.0].
    - Can only install one of: guzzlehttp/psr7[1.2.1, 1.3.0].
    - Can only install one of: guzzlehttp/psr7[1.2.2, 1.3.0].
    - Can only install one of: guzzlehttp/psr7[1.2.3, 1.3.0].
    - Installation request for guzzlehttp/psr7 (locked at 1.3.0) -> satisfiable by guzzlehttp/psr7[1.3.0].


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

Also I installed php composer.phar require guzzlehttp/guzzle before...

Upvotes: 1

Views: 18714

Answers (1)

Jeff Lambert
Jeff Lambert

Reputation: 24671

I would try removing your project's requirement of guzzlehttp/guzzle and let your Google dependency tell composer what version it wants to pull in. Google's package (for some reason) has a version floor of 1.2 for guzzlehttp/psr7, and composer is complaining that it can't figure out how to satisfy this requirement.

Since your new dependency (the Google package) also requires guzzlehttp/guzzle, you don't need to specifically require it, so I would just remove it and try composer update again.

Upvotes: 1

Related Questions