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).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +Composer 2
FileSize
4.96 KB

The 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.

greg.1.anderson’s picture

Status: Needs review » Reviewed & tested by the community

This 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.

greg.1.anderson’s picture

Issue tags: +Global2020
alexpott’s picture

Note that this issue is for Drupal 8 only - Drupal 9 already ships with 1.9.0

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 3159730-2.patch, failed testing. View results

greg.1.anderson’s picture

Status: Needs work » Needs review

Looks like a spurious failure. Re-queuing.

greg.1.anderson’s picture

Status: Needs review » Reviewed & tested by the community

The re-run passed; back to RTBC.

  • catch committed 704a519 on 8.9.x
    Issue #3159730 by alexpott, greg.1.anderson: Update composer/installers...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 704a519 and pushed to 8.9.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

alyaj2a’s picture

Run the following command to update and it worked for me
composer require composer/installers

vikrantd506’s picture

@alyaj2a your solution #12 worked for me.