I am using the Magento 2.3.2 version. When I run the "setup:di:compile" command then Can't remove directory: directory is not empty error occurred.

enter image description here

I have also set the permission of the generated folder but no luck.

Please tell me how to do this ?

Thanks in Advance.

  • try completely deleting the contents of the generated/code folder
    – Marius
    Oct 3, 2019 at 5:20
  • I have tried but same errror Oct 3, 2019 at 5:23

2 Answers 2


Give permission to generated folder from Terminal. Use below command

chmod -R -v 777 generated

After that run compile command and let me know if it's works.


Remove generated folder with - sudo rm -rf generated/ Then execute -

1) bin/magento s:up

2) bin/magento setup:static-content:deploy -f

3) bin/magento setup:di:compile

  • 1
    I have tried but no any luck Oct 3, 2019 at 5:30
  • 1
    @HardikMakwana, Happy coding help each other...! Oct 3, 2019 at 5:34

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.