using Drupal 8.8.1

composer require drupal/{{ any package }} returns

Installation failed, reverting ./composer.json to its original content.

Could not delete {{ ... }}/web/sites/default/default.services.yml

how are people handling this issue?


This command will fix it temporarily:

chmod u+w web/sites/default

But Drupal will harden parmission again soon. To turn it off add this to settings.php:

$settings['skip_permissions_hardening'] = TRUE;

Source: https://www.drupal.org/docs/develop/using-composer/starting-a-site-using-drupal-composer-project-templates#s-troubleshooting-permission-issues-prevent-running-composer

  • This answer adds some useful details - thanks for posting it. That said, naturally it doesn't seem like you'd want simply to turn off hardening as part of your generally applied solution. How about updating the answer to specify doing this in settings.local.php? – Kay V Jan 30 at 11:59

In fact requires granting the User write permissions:

chmod u+w web/sites/default

Looks like there's a bug being worked on in the core issue queue. That thread provides a link to a workaround in d.o. docs about Starting a Site Using Drupal Composer Project Templates.

I've updated that documentation page with this form of the solution (with credit to various ppl noted in the changelog of Starting a Site Using Drupal Composer...).

Others point out that you'll need to make this change after each time you "change a setting via the web interface, which removes write access again."

However, if you are using settings.local.php (you should!), it turns off the setting that would undo your permissions change and allows you to work more smoothly with composer on your local. (See $settings['skip_permissions_hardening'] = TRUE; and the docblock in that file that precedes it).

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.