2

I'm running Magento 2.4.2 and I'm using Composer v2.0.11. 2 days ago, after running, as usual, composer update, I suddenly received this error:

[ErrorException]
chmod(): Operation not permitted

You can see composer update -v output down below:

enter image description here

What I tried

  • I tried to apply chmod -R 777 . and chown -R www-data:www-data .
  • I tried to apply chmod u+x bin/magento

Any ideas?

2 Answers 2

4

Setting the filesystem ownership to the magento user (dev in my case, while before was assigned to www-data user) fixed the problem: chown -R dev:www-data .

3
  • Be sure to undo your chmod command if you successfully executed it, 777 permissions on the whole Magento filesystem is potentially very dangerous
    – user50070
    Commented Mar 23, 2021 at 18:10
  • Yeah, thanks for point this out. In developer mode I set them like this as described in the Magento doc: cd /var/www/magento && find . var generated vendor pub/static pub/media app/etc app/code app/design -type f -exec chmod g+w {} + && find var generated vendor pub/static pub/media app/etc app/code app/design -type d -exec chmod g+ws {} + && chown -R :www-data . && chmod u+x bin/magento
    – KaMZaTa
    Commented Mar 23, 2021 at 23:21
  • While in Production cd /var/www/magento && find . var generated vendor pub/static pub/media app/etc app/code app/design -type f -exec chmod g+w {} + && find var generated vendor pub/static pub/media app/etc app/code app/design -type d -exec chmod g+ws {} + && chown -R :www-data . && chmod u+x bin/magento
    – KaMZaTa
    Commented Mar 23, 2021 at 23:21
0

For windows

rm -rf vendor && composer install

For Ubuntu

sudo rm -rf vendor && sudo composer install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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