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.
Problem/Motivation
Running composer install on Drupal 8.9 with composer 2 fails. #3126566: Allow Drupal to work with Composer 2 didn't get finished for D8 because of all the fun we had with #3134648: [backport, needs scheduling] Don't pin the composer/installers version in drupal/core-recommended.
You get the following error:
composer install 743ms Fri 17 Jul 00:03:04 2020
The "composer/installers" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
> Drupal\Composer\Composer::ensureComposerVersion
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- composer/installers is locked to version v1.7.0 and an update of this package was not requested.
- composer/installers v1.7.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
Use the option --with-all-dependencies to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You are using a snapshot build of Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report an issue to them to ask them to support Composer 2. To work around this you can run Composer with --ignore-platform-req=composer-plugin-api, but this may result in broken plugins and bigger problems down the line.
Proposed resolution
Update composer/installers to a version that support Composer2. Now we're not pinning this only affect core development.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
composer/installers updated to 1.9.0 (same as D9).
Comment | File | Size | Author |
---|---|---|---|
#2 | 3159730-2.patch | 4.96 KB | alexpott |
Comments
Comment #2
alexpottThe funding changes are brought by composer. I'm on
Composer version 1.10.9 2020-07-16 12:57:00
so these are changes the upstream packages have made since our last update.Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedThis should be just fine to backport to Drupal 8.9. RTBC for 8.9.x and 9.0.x+
Note that composer/installers does not appear in core/composer.json, and therefore does not appear in the drupal/core-recommended metapackage, which is why we don't have the metapackages updating in this patch.
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedComment #5
alexpottNote that this issue is for Drupal 8 only - Drupal 9 already ships with 1.9.0
Comment #7
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedLooks like a spurious failure. Re-queuing.
Comment #8
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedThe re-run passed; back to RTBC.
Comment #10
catchCommitted 704a519 and pushed to 8.9.x. Thanks!
Comment #12
alyaj2a CreditAttribution: alyaj2a commentedRun the following command to update and it worked for me
composer require composer/installers
Comment #13
vikrantd506 CreditAttribution: vikrantd506 commented@alyaj2a your solution #12 worked for me.