From an existing site set up using the roundearth composer plugin method as detailed -> https://www.mydropwizard.com/blog/better-way-install-civicrm-drupal-8

composer create-project roundearth/drupal-civicrm-project:8.x-dev some-dir --no-interaction

How do I update this to use the newer https://lab.civicrm.org/dev/drupal/snippets/43composer require civicrm/civicrm-asset-plugin:'~1.0.0' pear/pear_exception:'1.0.1 as 1.0.0' civicrm/civicrm-{core,packages,drupal-8}:'^5.25' --prefer-source


1 Answer 1


Depending on how your initial site set up was created you might need to take a more extreme option detailed below but hopefully the following will work:

If you want you can copy composer.json , composer.lock to a new directory (or local) and use issue composer installto check the below works this can be useful if you are having problems and need to remove composer.lock and vendor. But I'm assuming you are going to be doing this on dev/staging.

composer remove roundearth/civicrm-composer-plugin --no-update
composer config extra.enable-patching true

civicrm/civicrm-{core,packages,drupal-8}:'^[civicrm latest version without the point version]'

Apart from the removal of the roundearth/civicrm-composer-plugin you want to follow the install steps outlined here: https://docs.civicrm.org/installation/en/latest/drupal8/

(Note D9 Drupal recommended you'll need to set the minimum stability from stable to dev if you haven't already).

If you are still on an older version of civicrm you might need to include pear/pear_exception:'1.0.1 as 1.0.0' in the above require. But the latest version doesn't require this anymore.

Assuming this is successful you will then want to drush updb drush cr

I'd also recommend clearing out web/libraries/civicrm/ and then repopulating with composer civicrm:publish

This is something you might need to repeat on live.

Note hopefully soon "pear/pear_exception:'1.0.1 as 1.0.0'" will not be required. Check the install instructions and mirror them.

Options to make things easier.

  • If your civicrm is not latest either upgrade first (best option) or use '[civicrm latest version]' (note missing '^' and you want full version with patch level i.le. '5.26.2' not '^5.26') to lock yourself to the specific civicrm version in composer.json - you will want to update to add the '^' in once complete and remove the point version to allow upgrades - or you might want to leave it like this to prevent composer update upgrading civicrm.
  • If you get composer conflicts in your dev/sandbox environment remove vendor and composer.lock. This will mean that you then end up running upgrades on everything - so best to do these first, or lock anything you need not upgraded in composer.json.
  • If you forget to remove roundearth/civicrm-composer-plugin you'll run into problems with resources not being copied correctly across to web/libraries. If you are not seeing the menu on load or are missing seeing an error for a missing file extension-compatibility.json you might need to make sure you have removed roundearth/civicrm-composer-plugin fully.
  • add --no-update to the second require then you can use composer update --dry-run along with all the packages you are adding/removing.

As per below check your civicrm.settings.php file and make sure the following are either removed or match the location where the libraries are stored.

$civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
$civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';

The extreme version below assumes you have no custom themes/modules or file uploads. If you have any of the above. You probably want to follow a different root!

I had done this once and I described it at https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161

  1. Backup civicrm.settings.php and drupal settings.php.
  2. Delete everything in the root folder, including drupal.
  3. cd <one folder up from root>
  4. composer create-project drupal/recommended-project:8.x.y <root folder>
  5. cd <into root folder>
  7. composer require civicrm/civicrm-asset-plugin:~1.0.1 civicrm/civicrm-core:dev-master civicrm/civicrm-packages:dev-master civicrm/civicrm-drupal-8:dev-master
  8. restore civicrm.settings.php and drupal settings.php
  9. If you have the two extra lines in civicrm.settings.php that were needed after roundearth+civi5.23, then you don't need them anymore, i.e. remove these lines
 $civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
 $civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';
  1. log in and clear caches

CAVEAT: As described in that thread it really depends where you started from and additionally what else you have installed via composer on that site and so you might not want to remove the whole drupal folder. The above was a pretty plain stock site and I was also converting to drupal-recommended at the same time. If you keep some things and for example if you've installed fancy modules, you may see composer throwing up irreconcilable differences.

Also the above was for a dev install, using dev-master. Replace dev-master with a specific 5.x.y or ^5.x as desired.

Further disclaimer: Civi + d8 has been a constantly moving target. It's repeatedly come up that what worked "2 months ago" doesn't quite work "now". I have not tried the above in the last 2 months.

  • 1
    I have pursed a slightly different path - This should be done on a dev/staging site. remove vendor ,composer.json and web/libraries/civicrm (this will be updated with a new structure but the existing structure will not be removed.) After doing so use lab.civicrm.org/dev/drupal/snippets/43 to create a new composer.json somewhere. Merge drupal modules and themes (and possible patches etc) in from your existing composer.json - and replace your composer.json with the result of this merge. Either do manually or composer require --no-update etc. Then composer update --with-all-dependencies Commented Jun 18, 2020 at 3:29
  • Before doing the above recommend running any updates you can separately. Commented Jun 18, 2020 at 3:30
  • I've made some edits to the above after running this process on another site - also you probably don't want to wipe everything in webroot! as this will include a lot of stuff you don't want to delete. Commented Jun 19, 2020 at 4:08
  • Cool. I had a similar note in the caveat but you're right that something like that should be up front, or at least in Comic Sans. Why does stackexchange not have Comic Sans???
    – Demerit
    Commented Jun 19, 2020 at 4:14

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.