Installing Drupal Console 1.9.4 on a fresh Drupal 8.8.5 site
I just installed a fresh Drupal 8.8.5 site using Drupals "new" recommended-project Composer template:
composer create-project drupal/recommended-project ./
Download and setup are working flawlessly, but when I try to require Drupal Console (currently at v1.9.4) I end up with a bunch of Composer errors:
$ composer require drupal/console:~1.10 --prefer-dist --optimize-autoloader
./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
- drupal/console 1.9.4 requires drupal/console-core 1.9.4 -> satisfiable by drupal/console-core[1.9.4].
- Conclusion: don't install drupal/console-core 1.9.4
- Conclusion: remove symfony/filesystem v4.4.7
- Installation request for drupal/console ^1.9 -> satisfiable by drupal/console[1.9.1, 1.9.2, 1.9.3, 1.9.4, v1.9.0]
- drupal/console-core v1.9.0 requires symfony/filesystem ~2.8|~3.0 -> satisfiable by symfony/filesystem[ .... ]
- Can only install one of: symfony/filesystem[v3.3.9, v4.4.7].
- Installation request for symfony/filesystem (locked at v4.4.7) -> satisfiable by symfony/filesystem[v4.4.7].
And there's a lot more lines like those above. Obviously Composer complains that drupal/console does not like symfony/filesystem v4.x, it requires some 3.x version. If you only downgrade symfony/filesystem to the latest 3.x version you'll run into another error:
- Installation request for symfony/dependency-injection (locked at v3.4.35) -> satisfiable by symfony/dependency-injection[v3.4.35].
- Conclusion: don't install drupal/console-core 1.0.1|remove symfony/finder v4.4.7|install symfony/finder 2.8.x-dev|install symfony/finder 2.8.x-dev|install symfony/finder 3.0.x-dev|install symfony/finder 3.1.x-dev .... |install symfony/finder v3.2.8|install symfony/finder v3.2.9
- Installation request for symfony/finder (locked at v4.4.7) -> satisfiable by symfony/finder[v4.4.7].
Well, symfony/finder version seems to be a problem too. Let's check the installed symfony packages:
$ composer show symfony/*
symfony/class-loader v3.4.35 Symfony ClassLoader Component
symfony/console v3.4.35 Symfony Console Component
symfony/debug v3.4.35 Symfony Debug Component
symfony/dependency-injection v3.4.35 Symfony DependencyInjection Component
symfony/event-dispatcher v3.4.35 Symfony EventDispatcher Component
symfony/filesystem v3.4.39 Symfony Filesystem Component
symfony/finder v4.4.7 Symfony Finder Component
symfony/http-foundation v3.4.35 Symfony HttpFoundation Component
symfony/http-kernel v3.4.35 Symfony HttpKernel Component
symfony/polyfill-ctype v1.12.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv v1.12.0 Symfony polyfill for the Iconv extension
symfony/polyfill-mbstring v1.12.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.12.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.12.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72 v1.15.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-util v1.12.0 Symfony utilities for portability of PHP codes
symfony/process v3.4.35 Symfony Process Component
symfony/psr-http-message-bridge v1.1.2 PSR HTTP message bridge
symfony/routing v3.4.35 Symfony Routing Component
symfony/serializer v3.4.35 Symfony Serializer Component
symfony/translation v3.4.35 Symfony Translation Component
symfony/validator v3.4.35 Symfony Validator Component
symfony/var-dumper v4.4.7 Symfony mechanism for exploring and dumping PHP variables
symfony/yaml v3.4.35 Symfony Yaml Component
All Symfony components except symfony/finder are down to v3.x. Symfony/finder still is on v4.4.7. So we'll have to downgrade this package too, before being able to install Drupal Console. So let's do that:
composer require symfony/filesystem:"~3.0"
composer require symfony/finder:"~3.0"
composer require drupal/console:~1.10 --prefer-dist --optimize-autoloader
$ drupal --version
Drupal Console version 1.9.4
And there you go with a brand new Drupal Console added to your site.
I've been running Drupal 8.8.x on the 3.x versions of those Symfony packages for quite a while now and didn't run into any problems so far. Before pushing this site to production you'd really want to remove Drupal Console and upgrade to the 4.x versions again.
Update for Drupal 8.9.x
On a Drupal 8.9.5 site I realized a similar issue when trying to install Drupal Console.
$ composer require drupal/console --prefer-dist --optimize-autoloader
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install drupal/console 1.9.5
- Conclusion: don't install drupal/console 1.9.4
...
- Installation request for drupal/console ^1.9 -> satisfiable by drupal/console[1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, v1.9.0].
- Conclusion: don't install symfony/css-selector v5.1.5
- drupal/console v1.9.0 requires symfony/css-selector ~2.8|~3.0 -> satisfiable by symfony/css-selector ...
The problem seems to be, that Drupal Console still has some Symfony ~2.8 or ~3.0 dependencies. Interesting thing is, that Console 1.9.5 is not depending on symfony/filesystem, symfony/finder versions ~3.0 anymore.
Downgrading Symfony's CSS Selector package allows installing Drupal Console.
composer require symfony/css-selector:"~3.0"
composer require drupal/console --prefer-dist --optimize-autoloade