Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Solution
Composer 1.10.11 has a bug. Use a newer version of Composer.
Original Report
Problem/Motivation
I'm trying to update drupal/core 8.9.3 -> 8.9.5. When using the command 'composer update', I get the following errors:
[RuntimeException]
Could not load package ezsystems/ezplatform in http://repo.packagist.org: [UnexpectedValueException] Could not parse version constraint dev-load-varnish-only-when-used as ^2.0@dev: Invalid version string "^2.0@dev"
[UnexpectedValueException]
Could not parse version constraint dev-load-varnish-only-when-used as ^2.0@dev: Invalid version string "^2.0@dev"
I'm not a developer, sorry for any incorrectness. How can I fix that?
Comments
Comment #2
cilefen CreditAttribution: cilefen as a volunteer commentedHello @quicktrick
ezsystems/ezplatform isn't part of Drupal Core. I recommend providing the composer.json file in case someone from the Drupal community wishes to help.
Comment #3
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have the same problem - see https://travis-ci.org/github/jonathan1055/scheduler/builds/725297776
It started around 15:00 UTC today
Comment #4
sandervanhooft CreditAttribution: sandervanhooft commentedSame problem here, problem started occurring just now.
See related Travis build.
Comment #5
Tim Bozeman CreditAttribution: Tim Bozeman at CyberSolution for Tag1 Consulting commentedMe too. Weird...
Comment #6
minorOffense CreditAttribution: minorOffense at Coldfront Labs Inc. commentedSame here. Two sites so far (d7 and d8) have failures because of this.
I think it might have to do with drupal/coder since that's the only project we have that's shared between the two sites. But I haven't actually confirmed that.
Comment #7
Neograph734It appears to be coming from composer 1.10.11. Rolling back to 1.10.10 makes the issue go away.
Was already reported in Composer's github repo: https://github.com/composer/composer/issues/9191
Comment #8
sandervanhooft CreditAttribution: sandervanhooft commentedhttps://github.com/composer/composer/issues/9191
Comment #9
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented@minorOffense " think it might have to do with drupal/coder since that's the only project we have that's shared between the two sites."
I think it is nothing to do with Coder, but 3rd party software, not directly under Drupal control. See the link in #7 above
Comment #10
cilefen CreditAttribution: cilefen as a volunteer commentedTry
composer why -r ezsystems/ezplatform
Comment #11
cilefen CreditAttribution: cilefen as a volunteer commentedComment #12
kunalkursija CreditAttribution: kunalkursija at Axelerant commentedI am using
Drupal 9.0.3
and I Faced this issue after updating the composer to '1.10.11'.Rolled back composer version as per #7 and the issue went away.
@jonathan1055 Even I was doing
composer require drupal/coder
right after updating the composer version. So after reading your comment, I triedcomposer require
for other modules - But the issue remained on composer version `1.10.11`. I agree it looks like a Non-Drupal issue.Comment #13
joelpittetComment #14
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedcomposer self-update 1.10.10
seems to fix itComment #15
kunalkursija CreditAttribution: kunalkursija at Axelerant commented+1 to #14
Comment #16
fixator1 CreditAttribution: fixator1 commentedwork after command: composer self-update --preview
Comment #17
kunalkursija CreditAttribution: kunalkursija at Axelerant commentedA new composer version has been released to fix this - https://github.com/composer/composer/issues/9191#issuecomment-689135410.
just tried it,
composer self-update
is updating to 1.10.12 and composer errors related toezsystems/ezplatform
are now gone.Comment #18
cilefen CreditAttribution: cilefen as a volunteer commentedComment #19
sholanryu81 CreditAttribution: sholanryu81 commentedI'm on composer 1.10.12 and am still getting this error
I updated to composer 2.0.0-alpha3 and still get the error also.
Comment #20
cilefen CreditAttribution: cilefen as a volunteer commented@sholanryu81 What is the output of
composer why composer/semver
?Comment #21
pingers CreditAttribution: pingers as a volunteer and at University of Adelaide commentedAppears fixed in composer 1.10.13. See https://github.com/composer/composer/issues/9191#issuecomment-689456130
Comment #22
AnybodyFor me it's still broken under 1.10.13 ... unsure why.
composer why composer/semver says:
composer/composer 1.10.10 requires composer/semver (^1.0)
drupal-composer/drupal-scaffold 2.6.1 requires composer/semver (^1.4)
drupal/core 8.9.3 requires composer/semver (^1.0)
drush/drush 9.7.2 requires composer/semver (^1.4)
Comment #23
cilefen CreditAttribution: cilefen as a volunteer commented@Anybody. Same here with 1.10.13, except for me it's just some module in the site with a 'dev' dependency:
All I've been able to do is downgrade Composer like in #14. I am concerned this is going to blow up into a bigger issue. The reason I asked about `composer why` is that I don't know to what extent (if any) the version of composer/semver installed in the site can affect this. This is happening only on a Drupal codebase, which happens to have composer/semver 1.5.1. This could be a red herring so treat this information appropriately.
Comment #24
RGonski CreditAttribution: RGonski commentedI have the same issue as #23. Have tried updating, regressing to earlier versions.
[RuntimeException]
Could not load package drupal/recaptcha in https://packages.drupal.org/8: [UnexpectedValueException] Could not parse version constraint dev: Invalid version string "dev"
[UnexpectedValueException]
Could not parse version constraint dev: Invalid version string "dev"
Comment #25
cilefen CreditAttribution: cilefen as a volunteer commentedHere is a minimal reproducer:
Try
composer update
with Composer 1.10.13 against the composer.json file above in an empty directory.Comment #26
cilefen CreditAttribution: cilefen as a volunteer commentedI commented on https://github.com/composer/composer/issues/9196.
Comment #27
MixologicUpstream has fixed most of the issues with this, yet there are still a few invalid versions in packages.drupal.org that we should catch and prevent from putting up to the facade.
Comment #28
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedCan we fix packages.drupal.org to remove this problem? It seems the issue is that this should not be allowed:
This is version 8.x-2.0 of the recaptcha module, and apparently only in that version. It may be that recaptcha is just one of many modules with broken versions in drupal.org, and since composer is not going to fix it, it should be fixed in packages. I think that ignoring any requires that are not correct should be enough. It will also serve to educate module maintainers when their requirements are ignored by composer.
Comment #29
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedNot sure which other issue is being used for this, but it seems that d.o has now fixed packages.d.o?
https://github.com/composer/composer/issues/9201
@Mixologic?
Comment #30
drummYes, Mixologic fixed this with https://bitbucket.org/drupalorg-infrastructure/drupal.org/commits/11baee..., which updates our dependency on composer used to validate
composer.json
files.Comment #31
MixologicYep. This is fixed. I still need to re-run the metadata generation on all the other projects to capture any other problems with rarer projects.
Comment #32
TrevorBradley CreditAttribution: TrevorBradley commentedIf anyone is *still* hitting this, try deleting your vendor directory and running "composer update" again.
Comment #33
alisonAre you saying we should downgrade composer and then if the problem still happens, remove vendor dir and run again? (I removed vendor directory and tried running composer update again, without luck, so far -- also ran composer clear-cache.)
Comment #34
MixologicWe're re-running the metadata currently (it takes about 3 days to reconstruct *all* of it), so there may still be some edge cases floating around.
@alisonjo315 it might be that you're encountering a different problem ?
Downgrading composer is first step if there are any issues. Then, once you have downgraded, your composer commands should run, and clear out any bad versions in the cache or vendor. Then you can upgrade composer again.