Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Updating to Drupal 8.5 with composer

Parent Feed: 

If you are like me, you might have already started planning the upgrade to Drupal 8.5, now that the first release candidate is out. It's awesome by the way, among other things, thanks to the incredible work done with layout builder. And if you are more like me, you are managing your sites with composer. Then, depending on the rest of your project, you might (also like me), have encountered some initial problems upgrading to Drupal 8.5

Having hit my fair share of composer oddities with running the Violinist.io composer monitor and upgrade service, I wanted to compile a couple of error messages along with solutions, to the folks struggling with this out there.

Installation request for webflo/drupal-core-require-dev (locked at 8.4.5, required as ~8.4) -> satisfiable by webflo/drupal-core-require-dev[8.4.5].

If you have installed an out of the box version of https://github.com/drupal-composer/drupal-project, this might be an error message you encounter. Full error message, for reference:

./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
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
    - webflo/drupal-core-require-dev 8.4.5 requires drupal/core 8.4.5 -> satisfiable by drupal/core[8.4.5] but these conflict with your requirements or minimum-stability.
    - webflo/drupal-core-require-dev 8.4.5 requires drupal/core 8.4.5 -> satisfiable by drupal/core[8.4.5] but these conflict with your requirements or minimum-stability.
    - webflo/drupal-core-require-dev 8.4.5 requires drupal/core 8.4.5 -> satisfiable by drupal/core[8.4.5] but these conflict with your requirements or minimum-stability.
    - Installation request for webflo/drupal-core-require-dev (locked at 8.4.5, required as ~8.4) -> satisfiable by webflo/drupal-core-require-dev[8.4.5].


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

The reason this fails is that the project you have created is depending on the dev packages for drupal core, which are tied to a specific version of core. So to update core, we also need to update the dev packages for core.

The solution to this is pretty simple:
Open your composer.json file and replace the lines for drupal/core and webflo/drupal-core-require-dev with the following:

"drupal/core": "~8.5"
// ...and
"webflo/drupal-core-require-dev": "~8.5"

Afterwards you can go ahead and run:

composer update drupal/core webflo/drupal-core-require-dev --with-dependencies

Edit: balsama pointed out in the comments that you can also run the command composer require drupal/core:~8.5.0 webflo/drupal-core-require-dev:~8.5.0 --no-update. However. This would move the package webflo/drupal-core-require-dev to "require" instead of "require-dev", which is probably not what you want. You could of course do a similar thing in 2 commands (one for require and one for require-dev), which would yield a similar result as updating by hand.

Installation request for symfony/config (locked at v3.2.14) -> satisfiable by symfony/config[v3.2.14].

This probably comes from the fact that you also have some other packages depending on this specific Symfony package in your project. Like drush or drupal console. This would not be a problem in itself, were it not for the fact that drupal/core 8.5 relies on the package symfony/dependency-injection that has specifically listed "symfony/config": "<3.3.7", as a conflict. Here is a full error message, for reference:

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
    - Conclusion: don't install drupal/core 8.5.0-rc1
    - Conclusion: don't install drupal/core 8.5.0-beta1
    - Conclusion: don't install drupal/core 8.5.0-alpha1
    - Conclusion: don't install drupal/core 8.6.x-dev
    - Conclusion: remove symfony/config v3.2.14
    - Installation request for drupal/core ~8.5 -> satisfiable by drupal/core[8.5.0-alpha1, 8.5.0-beta1, 8.5.0-rc1, 8.5.x-dev, 8.6.x-dev].
    - Conclusion: don't install symfony/config v3.2.14
    - drupal/core 8.5.x-dev requires symfony/dependency-injection ~3.4.0 -> satisfiable by symfony/dependency-injection[3.4.x-dev, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.2, v3.4.3, v3.4.4].
    - symfony/dependency-injection 3.4.x-dev conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-BETA1 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-BETA2 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-BETA3 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-BETA4 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-RC1 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.0-RC2 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.1 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.2 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.3 conflicts with symfony/config[v3.2.14].
    - symfony/dependency-injection v3.4.4 conflicts with symfony/config[v3.2.14].
    - Installation request for symfony/config (locked at v3.2.14) -> satisfiable by symfony/config[v3.2.14].

The solution here is to indicate you also want to update this package, even if it's not specifically required. So if the failing command was the following:

composer update drupal/core --with-dependencies

Go ahead and change it to this:

composer update drupal/core symfony/config --with-dependencies

Edit: To clarify based on a comment from balsama: It does not help to add the flag --with-all-dependencies here, since it is not related to a "sibling" dependency, or a nested dependency of the packages to be updated.

If you have other error messages, I would be glad to help out with a solution, and post the result here.

Credits

Thanks to zaporylie for looking into this with me, and to Berdir for pointing out the fact that core is not the package that requires symfony/config.

Let's finish this post with an animated gif of a composer

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web