The CiviCRM Installation Guide for Drupal 9 says to run these three lines of code:

composer config extra.enable-patching true
composer require civicrm/civicrm-asset-plugin:'~1.1'
composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.39'

We edited that last one to end with the latest version of CiviCRM, which today is 5.39, but anyhow if you run these commands today, on the second and third you will see this error:

$ composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.34'
./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
    - Root composer.json requires civicrm/civicrm-core ~5.34 -> satisfiable by civicrm/civicrm-core[5.34.0].
    - civicrm/civicrm-core 5.34.0 requires pear/validate_finance_creditcard dev-master -> found pear/validate_finance_creditcard[dev-master] but it does not match your minimum-stability.
  Problem 2
    - civicrm/civicrm-core 5.34.0 requires pear/validate_finance_creditcard dev-master -> found pear/validate_finance_creditcard[dev-master] but it does not match your minimum-stability.
    - civicrm/civicrm-drupal-8 5.34.0 requires civicrm/civicrm-core >=5.21.0 -> satisfiable by civicrm/civicrm-core[5.34.0].
    - Root composer.json requires civicrm/civicrm-drupal-8 ~5.34 -> satisfiable by civicrm/civicrm-drupal-8[5.34.0].


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

which is confusing. The issue is complicated, but we have a simple solution.

The solution is to require the “dev-master” version of the Pear packge “validate_finance_creditcard” like this:

composer require pear/validate_finance_creditcard:dev-master

After that, you can run the normal commands as above, and the CiviCRM code will be in place, ready for installation.

So the full sequence to install Drupal 9 itself and then CiviCRM is this:

composer create-project drupal/recommended-project .
composer require pear/validate_finance_creditcard:dev-master
composer config extra.enable-patching true
composer require civicrm/civicrm-asset-plugin:'~1.1'
composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.39'

2 Comments

  • Pierre François

    I am trying to install version 5.42 of civicrm using your recommandation above. When I run the last command (composer require civicrm/civicrm-{core,packages,drupal-8}:’~5.42′): I get an error:
    Problem 1
    – civicrm/civicrm-core[5.43.0, …, 5.43.2] require pear/validate_finance_creditcard 0.7.0 -> found pear/validate_finance_creditcard[0.7.0] but it conflicts with your root composer.json require (dev-master).
    – Root composer.json requires civicrm/civicrm-core ^5.43 -> satisfiable by civicrm/civicrm-core[5.43.0, 5.43.1, 5.43.2].
    I have no idea on how to solve this… Any help would be appreciated.

  • Pierre François

    I solved my problem by downgrading symfony/finder with:
    composer require symfony/finder:’~4.4.30′
    Then I was invited to downgrade guzzlehttp/guzzle. I did it with the command:
    composer -W require guzzlehttp/guzzle:’~6.5.5′
    This time I added the option ‘-W’ which seemed to solve all the dependency problems here.

Leave a Reply

Your email address will not be published.