4

I have a Magento 2 store which throws an error when entering production mode.

bin/magento deploy:mode:set production

Runs most the way until hitting deploy static content:

Something went wrong while deploying static content. See the error log for details.

Command returned non-zero exit code: `/usr/bin/php7.0 -f /var/www/mage2/public_html/bin/magento setup:static-content:deploy -f en_GB en_US` 

I can however run deploy static content without an error it seems.

In my logs i am getting a few errors for the theme with theme_dir not passed.

[InvalidArgumentException] Required parameter 'theme_dir' was not passed 

I am unsure why these are set to en_US however as would like them en_GB. I have all the themes set in the correct folders however i believe and am unsure how to resolve this error.

2
  • magento.stackexchange.com/q/100011/36463 Commented Mar 14, 2017 at 15:55
  • Glad I found this. I been facing problems turning Magento 2.3.2 to production mode and this helped solve the problem. Thanks. Commented Jul 4, 2019 at 14:05

1 Answer 1

15

Change the mode and skip the compilation:

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

And once the mode is switched you can deploy static content with GB locale.

php bin/magento setup:static-content:deploy en_GB 

Magento default locale is en_US so you have to define your language.

If that fails, make sure your /var and pub/ have the correct permissions

It could be that your PHP is exhausted so increasing the limit in php.ini should help but skipping the compilation and compiling after switch is a good workaround.

Also, make sure your store in use has a valid theme selected, it might be that you are using a theme that doesn't exist in the system.

3
  • I have fixed this now a while ago cant remember what it was but just needed to tidy up the question. Will mark as a solution however thanks for your help! Commented Jan 26, 2018 at 12:14
  • Didn't realise how old this post was. It was bumped up by community :D Hope it will help someone else Commented Jan 26, 2018 at 12:25
  • This was back when i first tried Magento 2 i think Commented Jan 26, 2018 at 12:26

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.