0

I get "The requested class did not generate properly, because the 'generated' directory permission is read-only" during setup:di:compile even though the folder has 777 permission.

I even tried with sudo, but I get the same error.

3 Answers 3

0

Try this command from CLI.

sudo chmod -R 777 var/ generated/

2
  • It is already set as 777, both var and generated.
    – Black
    Dec 30, 2022 at 13:47
  • Does that set properly? or it reset automatically when site is load on frontend? Jan 2 at 10:03
0

Try below setps and check.

rm -rf pub/static/frontend/ pub/static/adminhtml/ var/{cache,composer_home,page_cache,view_preprocesseds,di} generated/*

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo chmod -R 777 var/ generated/ pub/

Let me know if any query.

THANKS.

0
  1. Remove generated directory with the root user.

    sudo rm -rf generated

  2. Then switch to the Web server user (typically, it is www-data)

  3. Finally, compile code:

    bin/magento setup:di:compile

Your Answer

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

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