Problem/Motivation
I'm trying to use composer to update Drupal core to 9.4.4 but it's running into a problem when trying to fetch drupal/media:* as a dependency. This is preventing a Drupal core update unless I move the module out of composer.
Steps to reproduce
When I specifically require drupal/colorbox_media_video:^1.0 and drupal/core-recommended:9.4.4, I get a conflict that prevents composer from completing.
It can look different but here is a simple example when stability is set to alpha (we shouldn't need dev stability to install this):
Problem 1
- Root composer.json requires drupal/colorbox_media_video ^1.0 -> satisfiable by drupal/colorbox_media_video[1.0.0].
- drupal/colorbox_media_video 1.0.0 requires drupal/media * -> found drupal/media[dev-1.x, 1.x-dev (alias of dev-1.x)] but it does not match your minimum-stability.
Here is what happens when stability is set to dev:
Problem 1
- drupal/media dev-1.x requires drupal/core ^8 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev] but it conflicts with your root composer.json require (9.4.4).
- drupal/colorbox_media_video 1.0.0 requires drupal/media * -> satisfiable by drupal/media[dev-1.x, 1.x-dev (alias of dev-1.x)].
- drupal/media 1.x-dev is an alias of drupal/media dev-1.x and thus requires it to be installed too.
- Root composer.json requires drupal/colorbox_media_video ^1.0 -> satisfiable by drupal/colorbox_media_video[1.0.0].
Proposed resolution
Remove drupal/media:* as a composer requirement for the module. I think this may be left over from before media was in core. However, I can't tell if this is a bug with Drupal 9.4.4 or a change we need to live with.
Issue fork colorbox_media_video-3300783
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
inversed commentedIt looks like this is related to this change in 9.4.4: https://www.drupal.org/project/drupal/issues/3292380
Comment #4
inversed commentedWith a little motivation from the folks in the Slack #support channel, I created fork with a composer.json file to solve this.
You can see the details here: https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa...
Update your composer.json repositories section with the following:
Then, I ran the following:
composer require drupal/colorbox_media_video:dev-1.0.xAfter that, I was able to update to Drupal 9.4.4.
Comment #5
mmjvb commentedProbably easier to add to your composer.json:
"provide": {
"drupal/media": "*"
},
to satisfy the requirement.
Comment #6
inversed commented@mmjb that's a great suggestion! For anyone looking for a quick fix to this sort of problem, the approach is definitely faster and smoother to implement. It's similar to the functionality that was removed from 9.4.4 (they removed "replace" which is similar to progress). I switched over to this approach as it makes it easier to deal with my deployment.
Long term, I hope the maintainer gets the composer.json file from this fork committed to a new release. Otherwise folks will start to find this module is incompatible with Drupal as time goes on. Additionally, adding the "provide" section means it's no longer possible to override that package without removing the workaround first. For drupal/media that's not likely to be an issue but it could be a problem for other packages that do get replaced from time to time.
Comment #7
inversed commentedComment #8
mmjvb commentedLooks like they insist on making these kind of poor decisions and putting the blame on others.
It is recommended to qualify your dependencies. While not qualifying them worked in the past. They are now violating development according to semantic versioning by enforcing these recommendations. Thereby breaking what used to work.
Suggest to change dependencies in info.yml to use:
drupal:media
colorbox:colorbox
I am told that the facade will turn dependency on media into dependency on core. Consider that undesired, but it does keep composer happy depending on circumstances.
Wouldn't consider this a bug report, but will leave that to others.
Comment #9
spuky commentedThanks #5 helped a lot
Comment #10
dadderley commentedThank you mmjvb
Your solution in #5 worked for me
The addition of:
to composer.json
Allowed me to up upgrade core from 9.4.3 to 9.4.5.
Comment #12
joelpittetThough I agree both the
solution and the direct composer file (instead of the packaging one) would fix the issue, I think the simplest and most correct solution is @mmjvb mentioned in #8 #3300783-8: Composer conflict on drupal/media:* prevents Drupal 9.4.4 update
I created a new branch on this for that solution, though testing it would show the same results because the composer.json is not generated for the dev branch I wouldn't recommend testing that. I'd suggest the maintainer take a leap of faith... the solutions to similar problem are a not all the same so it's hard to compare but this should do the right thing.
Comment #13
mmjvb commentedIt is indeed recommended to qualify dependencies by their project. Causes an issue when moving (to core or contrib). So, don't consider that the right way nor does the enforcing it this way is. Also consider manipulation by the facade wrong. Dependencies should be kept minimal, allowing providers and replacing.
Not having projects on drupal.org, wonder what happens to those that provide a composer.json. There are still people not understanding the difference between dependencies in info.yml and composer.json.
Comment #14
johnpicozziI had this issue and used the composer addition suggested (Comment #10) and I can also confirm it worked.
This project needs a composer.json, I have reached out to the maintainer via Drupal Slack to see if we can at least get that to resolve this issue. Not sure it will do any good, but worth a try.
If anyone here is interested in maintaining this module you could follow the process here https://www.drupal.org/docs/develop/managing-a-drupalorg-theme-module-or... to take over unsupported projects.
Comment #15
vacilando commentedConfirming that
is a perfect workaround here.
Without finding this we could not update Drupal core.
Is there a proper fix in the works?
Comment #16
goldin commentedAlso confirming that #5 works. For those wondering exactly where to put it, I just added those lines to the very bottom of my site root composer.json file.
Comment #17
jeffc518 commentedThank you for this, I can also confirm #5 works. Until I specified a specific core version I wanted to update to, Composer wasn't giving me any clues with
composer update drupal/core 'drupal/core-*' --with-all-dependencies.. it just wouldn't grab the latest core.
Then for giggles:
composer update drupal/core:9.4.8 'drupal/core-*':9.4.8 --with-all-dependenciesYour requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/colorbox_media_video is locked to version 1.0.0 and an update of this package was not requested.
- drupal/colorbox_media_video 1.0.0 requires drupal/media * -> found drupal/media[dev-1.x, 1.x-dev (alias of dev-1.x)] but it does not match your minimum-stability.
.. Finally some feedback : )
Comment #18
joelpittet#5 is a workaround, maintainer please consider the MR.
Comment #20
tamerzg commentedThanks everyone, I just made a 1.0.1 release. Beside adding composer.json I also had to prefix Media dependency in colorbox_media_video.info.yml
Comment #21
tamerzg commentedComment #22
dadderley commentedThis was a particularly nasty issue that was not easy to diagnose.
Grateful for the fix, but haven't tried it yet.
Comment #23
inversed commentedI think we can mark this one closed. Composer has no problems updating to the 1.0.1 release on Drupal 9.4.8 after removal of the workaround from #5.
Comment #24
joelpittet@tamerzg could you also commit the https://git.drupalcode.org/issue/colorbox_media_video-3300783/-/compare/... fix to the formatting? You wouldn't have to maintain a composer.json if that was in place.
Comment #25
joelpittetComment #26
tamerzg commented@joelpittet drupal:media was already added in my previous commit
https://git.drupalcode.org/project/colorbox_media_video/-/blob/1.0.x/col...
and that seemed to fix the issue. I wasn't sure about composer.json which was also added in 1.1, but it seems I might remove it.