When requiring modules with composer on Drupal 8 or Drupal 9 you may run into the following error:
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Could not delete ../web/sites/default/default.services.yml
To fix this you have to grant your user write permissions to this folder with:
chmod u+w web/sites/default
If you're working locally and you have the default settings.local.php file included you won't have this problem because of the following line (do not enable this on production):
$settings['skip_permissions_hardening'] = TRUE;
Did you find this article useful?
Buy me a coffee.
Do you have a web development problem you cannot seem to be able to solve?
Send me an email or reach out to me on Twitter.