Hello everyone,
(Maintainence mode is on) running on Debian 10.
I ran composer update drupal/core "drupal/core-*" -- with-all-dependencies, and I got this error:
:
:
.... Update of composer/installers failed
[RuntimeException]
Could not delete /var/www/html/xxxxx/vendor/composer/installers/composer.json:
I have composer.json and composer.lock on 775 mode at the domain level, not the core level. However, for the /vendor/composer/composer.json file is currently on -rw-r--r-- root root Jan 14 2021
Any ideas ? I did run composer update and I get this same error. Also, tried the command: composer require drupal/core-recommended:9.2.5 --update-with-all-dependencies and same error. I need to upgrade to Drupal 9.2.5 due to security reasons.
Thanks in advance!
Jan
Comments
Something wrong with composer/installers
EDIT: Moved from https://www.drupal.org/forum/support/upgrading-drupal/2021-06-17/upgradi...
You should be able to update composer/installers. Looks like a security issue with composer/installers/composer.json. Remove it manually if you can't figure out why there is a problem. Hopefully, it is the only file with this issue.
You may want to try to update composer/installers separately. Find out which version it needs to be and update to that.
The --with-all-dependencies looks for any possible updates rather than needed updates. Suggest to whitelist needed updates rather than allowing possible updates. Use show, prohibits and depends to find out needed updates.
Composer/installers version
Thank you, mmjvb for your reply, and it is appreciated. The composer version I have currently is 2.0.11, and I don't know about updating installers since I'm relatively new in upgrading from Drupal 9.1.10 to 9.2.5. I have a documentation (Updating Drupal core via Composer, last updated on August 23, 2021) and followed it through. I will find out about show, prohibits and depends to find out needed updates....
Thanks!!
You are welcome
Unfortunately your situation goes beyond that documentation. Suggest to also keep current on composer itself: composer self update:
Every Drupal project needs the composer/installers to get the modules at the location Drupal expects them. Looks like it needs updating in your project, but fails due to a problem. Suggesting to solve that problem, allowing you to continue updating your project as documented. See protocol below:
Note that the version your project might need could be different. Also, just because there is an update for it, it doesn't mean you need it. Used --dry-run on the update to see what it wants to do, repeat without --dry-run when you are happy with what it is that it is going to do, to actually do it.
You could even remove and require composer/installers as it is just a plugin it needs to get things where you want in a Drupal project. As it is a plugin you might need --no-plugins to avoid loading it when trying to remove it. Just make sure it is back before you do anything Drupal related.
Successful upgrade to 9.2.5
mmjvb,
I upgraded Composer 2.1.8 successfully using this command: sudo composer selfupdate
Also, composer outdated -Dm and composer prohibits composer/installers 1.12.0 then composer/installers --dry-run <== that worked!!!!
Then I updated Drupal core: sudo composer update drupal/core "drupal/core-*" --with-all-dependencies
It worked !!! I'm so glad for your assistance, and hope this will help others.
Thank you again, mmjvb.
Good job
Glad you managed to get things working. Do wonder about your usage of sudo. Probably you need that for updating Composer. You shouldn't need it for using Composer to manage the codebase of your project.
Appreciate you being grateful for my assistance, hope indeed it helps others as well.