platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
221 stars 120 forks source link

Dependency resolution error with `drupal/console` #704

Closed alustenberg closed 6 years ago

alustenberg commented 6 years ago

During build of CLI within a container that also has drupal/console as a dependency, the build fails with the following dep resolution failure

      Installing build dependencies...
        Installing php build dependencies: drush/drush, drupal/console, platformsh/cli
        W: Changed current directory to /app/.global
        W: Loading composer repositories with package information
        W: Updating dependencies (including require-dev)
        W: Your requirements could not be resolved to an installable set of packages.
        W: 
        W:   Problem 1
        W:     - Conclusion: don't install guzzlehttp/guzzle 6.3.2
        W:     - Installation request for drupal/console 1.8.0 -> satisfiable by drupal/console[1.8.0].
        W:     - Conclusion: don't install guzzlehttp/guzzle 5.3.2
        W:     - Installation request for platformsh/cli 3.x-dev -> satisfiable by platformsh/cli[3.x-dev].
        W:     - drupal/console 1.8.0 requires guzzlehttp/guzzle ~6.1 -> satisfiable by guzzlehttp/guzzle[6.1.0, 6.1.1, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.3.1, 6.3.2].
        W:     - Can only install one of: guzzlehttp/guzzle[6.1.0, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.1.1, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.2.0, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.2.1, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.2.2, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.2.3, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.3.0, 5.3.0].
        W:     - Can only install one of: guzzlehttp/guzzle[6.3.1, 5.3.0].
        W:     - platformsh/cli 3.x-dev requires guzzlehttp/guzzle ^5.3 -> satisfiable by guzzlehttp/guzzle[5.3.0, 5.3.1, 5.3.2].
        W:     - Conclusion: don't install guzzlehttp/guzzle 5.3.1
        W: 

      E: Error building project: `composer` could not be run. Aborted build.

Appears this would need simultaneous dependency updates to guzzle 6.x against platform-cli as well as platform-client.

pjcdawkins commented 6 years ago

It's not possible to avoid dependency conflicts between independent packages installed with composer global require.

The solution is to install the CLI with the recommended method, the Phar installer, as described in: https://github.com/platformsh/platformsh-cli#installation

curl -sS https://platform.sh/cli/installer | php

If you can't use that, and/or really want to use Composer, avoid composer global require. Use something like cgr instead to avoid dependency conflicts. As it happens, cgr itself is written by Drush maintainers (and Drush also has a Phar-based install method).

I guess the .platform.app.yaml "dependencies->php" section could switch to using something like cgr to avoid the conflicts problem.

(BTW version 4.x.x of the CLI will use Guzzle 6+ - at least thanks to the minimum PHP version it's a BC-breaking change - version 4 works (#699) but won't be released until there's a need)