3

Has anyone documented using Composer 2 with an install and/or upgrade of Drupal 8 + CiviCRM?

I'm getting this error:

    - civicrm/composer-downloads-plugin[v2.0.0, ..., v2.1.1] require composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - civicrm/civicrm-core 5.30.1 requires civicrm/composer-downloads-plugin ^2.0 -> satisfiable by civicrm/composer-downloads-plugin[v2.0.0, v2.1.0, v2.1.1].
    - Root composer.json requires civicrm/civicrm-core 5.30.1 -> satisfiable by civicrm/civicrm-core[5.30.1].
1
  • It's come up in chat and for now the advice seems to be stick with 1.x.
    – Demerit
    Commented Nov 18, 2020 at 23:52

2 Answers 2

5

It should be possible to do any one of these:

  • Use CiviCRM 5.31+. The error message above suggests it is using 5.30.x, which has older metadata. (Compare: 5.31's composer.json vs 5.30's composer.json)

  • Stick to composer v1 for as long as you're using an older version of Civi.

    composer self-update --1
    

    In the future, after you switch to a newer version of Civi (eg 5.31+), you can continue to composer v2:

    composer self-update --2
    
  • Coerce the versions. Tell composer to install a new version of composer-downloads-plugin (v3.0.0 -- which supports composer v2) and pretend like it's an old version (v2.1.99 -- which is expected in civicrm-core v5.30). Command:

    composer require 'civicrm/composer-downloads-plugin:v3.0.0 as v2.1.99'
    

    In the future, after you switch to a newer version of Civi (eg 5.31+), you should edit composer.json and remove the coerced constraint. Otherwise, you may see weird behavior.

2

Although as of today (2020-11-20) there's no official word, I can see work being done towards this, e.g.

https://github.com/civicrm/composer-downloads-plugin/releases/tag/v3.0.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.