Magento – M2 – Cannot change deploy mode to Production

command linedeploymagento2production-mode

I am trying to set the deploy mode on an M2 instance to Production from Developer.
On my local environment however I keep getting the error message:

Command returned non-zero exit code:
'/Applications/MAMP/bin/php/php7.0.10/bin/php -f /Applications/MAMP/htdocs/JWM2/bin/magento setup:di:compile'

When it errors and escapes back to the prompt, I type echo $? and simply get 1 returned back.

On the recommendation of another post, I have tried increasing the php memory_limit which didn't help. I have also tried running the setup:di:compile command separately, but this completed successfully, however there were some errors relating to the dependancies already existing in context objects for a couple of modules.

When I try to change the deploy mode on the production server, the issue lies with the setup:static-content:deploy part of the process with the issue being with the Magento Backend theme.

If I add the flag --skip-compilation to the deploy:mode:set production then it slides in to the correct mode without problem.

Has anyone got any ideas how I can make this work with compilation?

Best Answer

If you run

/Applications/MAMP/bin/php/php7.0.10/bin/php -f /Applications/MAMP/htdocs/JWM2/bin/magento -vvv setup:di:compile

it will show you what problem do you have

Related Topic