Class Magento\Framework\Mail\EmailMessageInterfaceFactory does not exist Class Vendor\Extension\Model\Mail\TransportBuilder\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only.

I found some solutions but none worked.

Thanks in advance,


3 Answers 3


Run the command: (To give permissions to generated folder) as:

chmod -R 777 /var/www/html/generated

and run

bin/magento setup:di:compile


Try following commands in your magento root folder

chmod -R 777 var generated pub
chown systemusername:systemusername var generated pub
php bin/magento setup:di:compile

Delete folder

rm -rf generated/*

and try again (and check that you are running the command from a user account and not from root)

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.