Today I have been dealing with a particular case updating the Webform module to its most recent version, a task that should only take a few minutes took me more than an hour due to a slightly strange error in the process, the following problem appeared.
What is understood by reading the message thrown is that behat/mink-selenium2-driver requires version 1.4.x-dev but webflo/drupal-core-require-dev in its most recent version 8.8.8 requires version 1.3.x- dev a somewhat complex problem considering that apparently it is something in the core.
Analyzing the composer.json file I see that webflo/drupal-core-require-dev is in the require-dev section.
Being part of the core of Drupal, I took on the task of searching through the comments on drupal.org and one incident in particular gave me a clue as to what was happening, I was not the first one it happened to and the user @smutek commented that the dependency could be removed although in his case it had given him an error, but not the following who tried it, the option worked for all of them, so I decided to try it.
The execution was successful, it removed a group of packages and updated the same, the behat package was gone and then everything should be OK.
Considering that in my case it was a site installed using the Drupal composer project template, I wanted to check how the composer.json of the most recent version was since it was very likely that it had changed. In another article I had already talked about how to update the core in this template and it had a variation and this one was certainly no exception, although in my case it was a contributed module.
Checking I found that in the most recent version the drupal/core-dev package was the one that had come to replace webflo/drupal-core-require-dev, although according to what I read in an open case on Drupal.org , they are not really necessary for a production site since they are only used for development environments and will be removed in Drupal 9.
Since we are not yet in Drupal 9, I don't know what could break it unintentionally, I preferred to add it to the composer.json manually and rebuild the composer.lock with the variation.
$ composer update --lock
Once the problem package was removed, I finally proceeded with updating the webform module with:
$ composer update drupal/webform
And finally the update was possible.
Conclusions
- The underlying problem was that we were using an obsolete package in composer.json, which had to be replaced.
- You need to pay attention to the changes that composer.json undergoes with each core update in order not to become outdated.
- Maybe the development package is not necessary but out of caution I left it.