composer require fails because it can’t delete


Using composer with Drupal ( 8 & 9), composer require drupal/<package-name> returns the following error.

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

Could not delete web/sites/default/

Since you want to use composer require command only on non-production environments, the following steps affect only on the machines you deliberately set up. Drupal’s recommended configuration will be preserved on all other machines, including production servers.


  1. enable settings.local.php (here are the instructions from the docblock in settings.local.php):
 * To activate this feature, copy and rename it such that its path plus
 * filename is 'sites/default/settings.local.php'. Then, go to the bottom of
 * 'sites/default/settings.php' and uncomment the commented lines that mention
 * 'settings.local.php'.
 * If you are using a site name in the path [... read about exceptions in file]
  1. set file permissions to allow user and group to write to the file on your local machine:
$ chmod ug+w {name_of_docroot}/sites/default

Similar Posts:


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Comment

Your email address will not be published.

Scroll to Top