3

When I try to bin/magento deploy:mode:set production I get the error

Command returned non-zero exit code

I already tried to

  • increase memory with -d memory_limit=2G
  • bin/magento setup:upgrade
  • clear var/cache

nothing worked.

When I do

bin/magento deploy:mode:set production --skip-compilation

bin/magento setup:di:compile

it runs successfully but the frontpage is messed up. The standard Luna theme is just a HTML output without any CSS or JS.

Here's the output of

bin/magento deploy:mode:set production -vvv 

#0 /vendor/magento/module-deploy/Model/Filesystem.php(267): Magento\Framework\App\Shell->execute('/opt/plesk/php/...') #1 /vendor/magento/module-deploy/Model/Filesystem.php(172): Magento\Deploy\Model\Filesystem->compile(Object(Symfony\Component\Console\Output\ConsoleOutput)) #2 /vendor/magento/module-deploy/Model/Mode.php(139): Magento\Deploy\Model\Filesystem->regenerateStatic(Object(Symfony\Component\Console\Output\ConsoleOutput)) #3 [internal function]: Magento\Deploy\Model\Mode->Magento\Deploy\Model{closure}() #4 /vendor/magento/framework/App/Console/MaintenanceModeEnabler.php(85): call_user_func(Object(Closure)) #5 /vendor/magento/module-deploy/Model/Mode.php(147): Magento\Framework\App\Console\MaintenanceModeEnabler->executeInMaintenanceMode(Object(Closure), Object(Symfony\Component\Console\Output\ConsoleOutput), false) #6 /vendor/magento/module-deploy/Console/Command/SetModeCommand.php(101): Magento\Deploy\Model\Mode->enableProductionMode() #7 /vendor/symfony/console/Command/Command.php(255): Magento\Deploy\Console\Command\SetModeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /vendor/symfony/console/Application.php(893): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Deploy\Console\Command\SetModeCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /vendor/magento/framework/Console/Cli.php(102): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Thank you very much in advance

19
  • Is the compilation successful? Apr 1 '19 at 9:03
  • Yes, it says "Generated code and dependency injection configuration successfully". (but only if I do --skip-compilation and then setup:di:compile). But then the page is messed up, though.
    – zlep
    Apr 1 '19 at 9:07
  • Give read and write permission to "generated", "Var", "app/etc" and "pub/static" folder. Apr 1 '19 at 9:18
  • Hm, these folders already have read/write permission.
    – zlep
    Apr 1 '19 at 9:21
  • Can you please check your log files? Can you deploy the files once again in production mode? Are you getting any 404 errors in your browser console? Apr 1 '19 at 9:25
1

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

Won't work to solve this problem.

To fix this you need to increase the PHP Memory Limit in the php.ini file on your server.

Increase it to any greater value e.g 1024M or 2G or 5G.

This will solve the problem..

0

You should press command

sudo chmod -R 777 var/ pub/
0
0

You need to run this command:

chmod -R 777 var pub generated

Please let me know if it works!

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.