Whenever I execute setup:di:compile and setup:static-content:deploy commands from SSH, magento2 frontend and backend showing error. My magento2 store in production mode.

What should I do before run SSH command so that frontend/backend should be work while executing commands?


Well that's a native macrocosm of Magento 2.

As you know, when we are running commands specially compile and static content deploy command.

Magento compiles each and every file with their assets and js and links to pub/static directory.

so when compilation is going on - it will shows the errors as all file are still not compiled/deployed so you only has the option to wait until command execution is completed for all the files.

But for prevention you can make/enable website maintenance mode when you are running command.

So customer of the website will see notice that website is in maintenance mode for few mins.

Once command execution is completed you can disabled maintenance mode for the same.

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.