I am running composer on Drupal 7 and I am just trying to update my site; however when I run composer update, the composer deletes all the preserve paths I had specified.

My structure is as follows:





in my composer.json I have as follow:

"repositories": [
        "type": "composer",
        "url": "https://packages.drupal.org/7"
"require": {
"conflict": {
    "drupal/core": "8.*"
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
      "sort-packages": true
"autoload": {
    "classmap": [
"scripts": {
    "pre-install-cmd": [
    "pre-update-cmd": [
    "post-install-cmd": [
    "post-update-cmd": [
    "post-create-project-cmd": [
"extra": {
    "installer-paths": {
        "web/": ["type:drupal-core"],
        "web/profiles/{$name}/": ["type:drupal-profile"],
        "web/sites/all/drush/{$name}/": ["type:drupal-drush"],
        "web/sites/all/libraries/{$name}/": ["type:drupal-library"],
        "web/sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
        "web/sites/all/themes/contrib/{$name}/": ["type:drupal-theme"]
    "patches": {
        "cweagans/composer-patches": {
            "Call the preserve paths hooks" : "https://github.com/SebCorbin/composer-patches/commit/1cb9bacba51f8bba0c5f3f322c3bb61e4ceae974.patch"
    "preserve-paths": [


What ends up happening is it install the core and modules correctly in web/ folder, but deletes all the preserve paths as well. Any suggestions as to why i am having this problem? Thank you.

I have tried to put composer.json in the web/ folder as well, that just imports all the require modules and core in a subfolder (web/web/).

I am now getting:

Files of installed package were overwritten with preserved path x/web/sites/default!

Files of installed package were overwritten with preserved path x/web/sites/all/libraries!

and the preserve paths didn't do anything.


It looks like you haven't installed the plugin. Just run:

composer require drupal-composer/preserve-paths

And try again.

If it still doesn't work, you'll probably need to report it as a bug to the plugin's issue queue.

  • It is doesn't work when 'composer reinstall drupal/drupal' – Mykola Veriga Aug 26 '19 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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