Magento 2 - Problem setting to production mode: Non Zero Exit Code

Hi Guys,

Hope you are ok and new year 2020 is treating you well, just wanted to share a quick article with you guys related to problem or issue setting Magento 2 instance from developer to production mode and get the following error -:

Command returned non-zero exit code in red, this error could be related to either folder permissions or lack of memory to run compilation or static deployment command. The following commands helped us switching our Magento 2 website to production mode -:

php magento deploy:mode:set production --skip-compilation php -dmemory_limit=5G magento setup:di:compile php -dmemory_limit=5G magento setup:static-content:deploy en_GB en_US 

Please note, we have added -dmemory_limit=5G to compile and static content deployment commands because if the issue is related to memory then adding memory limit to the commands will help for sure.

That’s it, Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

Similar Posts