In Magento 2, when I went to change my store mode from Developer to Production from cmd(putty), it will return one error message

Command return non-zero exit code :

So how can I fixed it and if possible then please tell me is there anything wrong from our side.


  • wich command you have used? – Birjitsinh Zala Jan 18 '18 at 4:38
  • i have use php bin/magento deploy:mode:set production – Sam Mar 16 '18 at 4:59

First check which mode display

php bin/magento deploy:mode:show

production mode

php bin/magento deploy:mode:set production

Please Refer this Link



  • I have checked but still, it's not working for me. the same error message is displayed. can you please suggest any reference video for fixed this issue. – Sam Mar 16 '18 at 9:04

use this

php bin/magento deploy:mode:set production
  • I have try it but error is still show. Is there any server configuration issue ? – Sam Jan 18 '18 at 4:50
  • please send me error description beacause after run this command include comile and static-content deploy ...possible error at setup:di:compile – Birjitsinh Zala Jan 18 '18 at 4:53

It may be a file permission issue, so first you have to set the permission of var and pub folders

sudo chmod -R 777 var pub

Then set the mode as you want.

php bin/magento deploy:mode:set production

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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