简体   繁体   中英

Can not update google/cloud-firestore [composer]

Now, I am using google/cloud-firestore ^0.8.1 and I want to update this library to latest version (0.14.0). My composer.json now looks like:

"require": {
"grpc/grpc": "^1.10",
"google/protobuf": "^3.5",
"google/gax": "^0.31.3",
"google/cloud-firestore": "^0.8.1",
"firebase/php-jwt": "^5.0",
}

When I try to update firestore library with php composer.phar require google/cloud-firestore , I got:

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for google/cloud-firestore ^0.14.0 -> satisfiable by google/cloud-firestore[v0.14.0].
    - google/cloud-firestore v0.14.0 requires google/gax ^0.37 -> satisfiable by google/gax[0.37.0] but these conflict with your requirements or minimum-stability.


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

After that, I tried with php composer.phar require google/gax and got:

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
    - google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
    - google/cloud-firestore v0.8.1 requires google/gax ^0.31.1 -> satisfiable by google/gax[0.31.x-dev].
    - Can only install one of: google/gax[0.37.0, 0.31.x-dev].
    - Installation request for google/gax ^0.37 -> satisfiable by google/gax[0.37.0].
    - Installation request for google/cloud-firestore ^0.8.1 -> satisfiable by google/cloud-firestore[v0.8.1].


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

I added "minimum-stability": "dev" to composer.json but that didn't resolve problem. How to properly update these libraries and fix dependencies between them?

The semantic versioning operator ( ^ ) behaves slightly different with pre-1.0 releases (see https://getcomposer.org/doc/articles/versions.md#caret-version-range- ):

For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as ? >=0.3.0 <0.4.0 .

This means that you will have to update both packages like this:

composer require google/cloud-firestore:^0.14 google/gax:^0.37

With @xabbuh help, I find out solution. There wasn't problem just in semantic versioning operator (^) but in packages I wanted to update. I needed to install/update all packages that are needed for updating firestore on version 0.14. I called composer require google/cloud-firestore:^0.14 and after that composer require google/gax:^0.37 and after that tried with reverse order, but there were similar error messages. When I included all packages needed into require command for updating firestore package it passed well. So, here are working command:

composer require google/cloud-firestore:^0.14 google/gax:^0.37 google/auth:^1.3 google/grpc-gcp:^0.1.0 grpc/grpc:^1.13.0 google/cloud-core:^1.23

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM