I can't run setup:di:compiler, the error are:

Class Magento\Checkout\Model\DefaultConfigProvider\Interceptor generation error: The requested class did not g  
  enerate properly, because the 'generated' directory permission is read-only

What i try:

1) Set 777 to generated folder (chmod -R 777 generated/* ) 2) Create a user (named "permisos" with a group named "permisos"), assing it on apache 2 evn, restart apache, do sudo permissions to that user, and try the command again 3) run command, put again 777 permisions to generated, run command 4) Delete all caches with c:c and folders in cache at var.

As i see, wen i run command with ROOT user, the 777 permisions change and toe owner of generated/code change to root:root, if i run with "permisos" user i get same error, but users are permisos:permisos

Have any idea on how to solved it?

Extra info: Magento 2.3, Apache server, Google Cloud (all are for test pruposes)


1 Answer 1


if you use Magento 2.2 and above

the below might sort you out:

find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {}

what is missing is the recursive write permissions and this is made with the s towards the end of the line above

see full docs to set permissions at: https://devdocs.magento.com/guides/v2.2/install-gde/prereq/file-system-perms.html

  • The error continue. I try also set 777 to all var/www/html folder with chmod -R 777 html but not work
    – Alexis
    Commented Jul 17, 2019 at 19:38
  • you might want to empty generated folder first. Make sure ownerships is given to the webserver user. Commented Jul 17, 2019 at 19:55

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.