Ask a Question

Categories
< All Topics
  • Main
  • Magento 2
  • Command returned non-zero exit code: (Switch from developer to production)
Print

Command returned non-zero exit code: (Switch from developer to production)

When switching from developer mode to production (bin/magento deploy:mode:set production). You may receive the following error:

Starting compilation
Something went wrong while compiling generated code. See the error log for details.
Skipped disabling maintenance mode
Command returned non-zero exit code:
`/opt/cpanel/ea-php74/root/usr/bin/php -f /home/{username}/public_html/bin/magento setup:di:compile`

Solutions

Scenario 1:

Most probably one of your extensions is not compatible with the Magento version or with PHP version. Try to disable all third-party extensions and find the extension(s) cause problem by enabling one by one.

Scenario 2:

Running below SSH lines:

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

may help to switch from developer mode to production but again the issue is not resolved.

Scenario 3:

Some also may suggest increasing the PHP Memory Limit*, in some cases it may help but again, the problem is there to be resolved.

*Example: increase the memory limit to 4GB by running:

php -d memory_limit=4GB bin/magento deploy:mode:set production

or change the memory limit on your php.ini file.

Scenario 4:

Sometimes on VPS servers, you may have PHP version or path issue, make sure which PHP version is in use (php -v), and running the SSH line with full PHP path may resolve the issue:

/opt/cpanel/ea-php74/root/usr/bin/php -f /home/{username}/public_html/bin/magento deploy:mode:set production

 

 

Next Disable or Enable MSI (Saleable Quantity) | Magento 2
0 Comment

No Comment.

Table of Contents
Home
Search
WhatsApp