Answers.Body: <p>As per comments there were some leftover installed vendor files and removing composer.lock and the entire vendor folder and also web/modules/contrib/civicrm and then trying again clears it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-27T18:07:47.497Z
Answers.LastActivityDate: 2021-04-27T18:07:47.497Z
Answers.UserDisplayName: Demerit
Body: <p>I am trying to install CiviCRM on a Drupal 8 site using Composer 2.  I am getting the error below.  Is this a Composer 2 issue?  Do I need to revert to Composer 1?  Is there a different fix?  Thx.</p>
  <p>=======================================</p>
  <p>composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.36'</p>
  <p>./composer.json has been updated
  Running composer update civicrm/civicrm-core civicrm/civicrm-packages civicrm/civicrm-drupal-8
  Loading composer repositories with package information
  Updating dependencies
  Your requirements could not be resolved to an installable set of packages.</p>
  <p>Problem 1
  - civicrm/civicrm-core[5.36.0, ..., 5.37.x-dev] require symfony/finder ~3.0 || ~4.4 -&gt; found symfony/finder[v3.0.0-BETA1, ..., 3.4.x-dev, v4.4.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.2.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
  - Root composer.json requires civicrm/civicrm-core ~5.36 -&gt; satisfiable by civicrm/civicrm-core[5.36.0, 5.36.1, 5.36.x-dev, 5.37.x-dev].</p>
  <p>Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.</p>
  <p>Installation failed, reverting ./composer.json and ./composer.lock to their original content.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-27T17:06:53.693Z
Comments.Text: Based on the error message, I would try removing composer.lock and the entire vendor folder and also web/modules/contrib/civicrm then trying again. It sounds like an earlier attempt failed and it's now in a stuck situation. Composer 2 should work, but also is this drupal 8 or 9?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-27T17:49:42.347Z
Comments.Text: @Demerit, Thank you very much.  Your suggestions worked.  This is on a Drupal 8 site that I used a theme demo as the starter.  That might have created a bit of a goofy setup to begin with.  Thanks again!
Comments.UserDisplayName: Marv S
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-27T18:07:02.460Z
Comments.Text: Great, glad it worked.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-16T22:35:09.170Z
Comments.Text: Just to keep the record going (and for anyone who has a similar issues), this also happened on a Drupal 9 vanilla installation.  The solution also works on D9.  Thx.
Comments.UserDisplayName: Marv S
Tags: <drupal><composer>
Title: Composer 2 and CiviCRM Installation Error
ThreadText: # Composer 2 and CiviCRM Installation Error
  
  (Asked by: username_0 on 2021-04-27)
  
  I am trying to install CiviCRM on a Drupal 8 site using Composer 2. I am getting the error below. Is this a Composer 2 issue? Do I need to revert to Composer 1? Is there a different fix? Thx.
  
  =======================================
  
  composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.36'
  
  ./composer.json has been updated
  Running composer update civicrm/civicrm-core civicrm/civicrm-packages civicrm/civicrm-drupal-8
  Loading composer repositories with package information
  Updating dependencies
  Your requirements could not be resolved to an installable set of packages.
  
  Problem 1
  - civicrm/civicrm-core[5.36.0, ..., 5.37.x-dev] require symfony/finder ~3.0 || ~4.4 -> found symfony/finder[v3.0.0-BETA1, ..., 3.4.x-dev, v4.4.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.2.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
  - Root composer.json requires civicrm/civicrm-core ~5.36 -> satisfiable by civicrm/civicrm-core[5.36.0, 5.36.1, 5.36.x-dev, 5.37.x-dev].
  
  Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
  
  Installation failed, reverting ./composer.json and ./composer.lock to their original content.
  
  **Tags:** drupal, composer
  
  > **Comments:**
  > **username_1**: Based on the error message, I would try removing composer.lock and the entire vendor folder and also web/modules/contrib/civicrm then trying again. It sounds like an earlier attempt failed and it's now in a stuck situation. Composer 2 should work, but also is this drupal 8 or 9?  
  > **username_0**: @username_1, Thank you very much.  Your suggestions worked.  This is on a Drupal 8 site that I used a theme demo as the starter.  That might have created a bit of a goofy setup to begin with.  Thanks again!  
  > **username_1**: Great, glad it worked.  
  > **username_0**: Just to keep the record going (and for anyone who has a similar issues), this also happened on a Drupal 9 vanilla installation.  The solution also works on D9.  Thx.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-04-27. Score: 2 | Accepted answer
  
  As per comments there were some leftover installed vendor files and removing composer.lock and the entire vendor folder and also web/modules/contrib/civicrm and then trying again clears it.
  
  
  ---
  
  