Anesh Ranjit
Anesh Ranjit

Reputation: 1

setup:di:compile and changing mode to production fails in Magento 2

When I try to change mode from developer to production a non-zero exit code is returned. I figured out it was not during deployment of static content, it was during compilation. memory_limit is 2000M. I checked php bin/magento setup:di:compile and found out that it stops and exits compilation at Repositories code generation... without showing any error. I migrated the site to localhost, and now it successfully compiles and goes to production mode.

Why is it working in localhost, but fails in the online server?

Upvotes: 0

Views: 3217

Answers (2)

Abhinav Kumar Singh
Abhinav Kumar Singh

Reputation: 2325

Open admin : store> configuration > Advanced > Developer >Frontend Development Workflow > Workflow type > Server Side less compilation then

Use below commonds for set production mode.

rm -rf var/*
rm -rf pub/static/*
php bin/magento deploy:mode:set production --skip-compilation
php -dmemory_limit=6G bin/magento setup:static-content:deploy
chmod -R 7777 var pub/static

Upvotes: 3

Mohd Miraj
Mohd Miraj

Reputation: 96

Hi use this command to deploy when getting memory-limit problem.

php -dmemory_limit=6G bin/magento setup:static-content:deploy

Upvotes: 0

Related Questions