When I switch my site to production it completely breaks because it tries calling .min.js and .min.css files. But these do not exist on the server.
Site works in developer mode, so I have to leave it in that.
I have been through the whole setup:upgrade, compile, deploy, cache clean several times in developer mode, and they do not get generated.
Do you have to run the command when it is in production mode to generate the files? If so, then it means the site will break while I run the commands.
Hi @infoamityw093d ,
In developer mode try below things first.
Store => Configuration => Advanced => Developer
Set Minify HTML => No
Set Merge Javascript => No
Set Minify Javascript => No
Set Enable Javascript Bundling => No
Set Move JS Code to Bottom => No
Set Merge CSS File => No
Set Minify CSS File => No
Fire below command
php bin/magento deploy:mode:set production
Check your site again if looks good then do below steps
php bin/magento deploy:mode:set developer
Set Merge Javascript => Yes
Set Merge CSS => Yes
php bin/magento deploy:mode:set production
Check site again and if looks good then do below steps
php bin/magento deploy:mode:set developer
Set Minify Javascript => Yes
Set Minify CSS => Yes
php bin/magento deploy:mode:set production
Check site again and if looks good then do below steps
php bin/magento deploy:mode:set developer
Set Minify HTML => Yes
php bin/magento deploy:mode:set production
In this way you can find which step is creating issue.
Problem Solved? Accept as Solution!
Hope it helps!
Thanks
Thanks for your reply. I have turned off minify and merge and its working in production now.
I have not re-enabled minify and merge though because every time I run the commands like turn to production/developer, the site goes into Maintenance mode for approx. 5 minites. When I often run the compile and deploy commands the site goes down. Is this normal? Becuase it means I really want to avoid working on the site. I have never come across a website that need to go offline for 5 minutes every time some basic standard tasks are performed. I also get errors in the CII like the following:
Command returned non-zero exit code: `bin/magento setup:static-content:deploy -f en_GB` mysite@rc1:~/webapps/mysite$ bin/magento setup:di:compile The directory "/home/mysite/webapps/mysite/generated/code/Magento/Sales" cannot be deleted Warning!rmdir(/home/mysite/webapps/mysite/generated/code/Magento/Sales): Directory not empty The directory "/home/mysite/webapps/mysite/generated/code/Magento/Catalog" cannot be deleted Warning!rmdir(/home/mysite/webapps/mysite/generated/code/Magento/Catalog): Directory not empty mysite@rc1:~/webapps/mysite$ bin/magento setup:di:compile The directory "/home/mysite/webapps/mysite/generated/code/Magento/Framework/View" cannot be deleted Warning!rmdir(/home/mysite/webapps/mysite/generated/code/Magento/Framework/View): Directory not empty mysite@rc1:~/webapps/mysite$ bin/magento setup:di:compile The directory "/home/mysite/webapps/mysite/generated/code/Magento" cannot be deleted Warning!rmdir(/home/mysite/webapps/mysite/generated/code/Magento): Directory not empty mysite@rc1:~/webapps/mysite$ bin/magento setup:di:compile The directory "/home/mysite/webapps/mysite/generated/code/Magento" cannot be deleted Warning!rmdir(/home/mysite/webapps/mysite/generated/code/Magento): Directory not empty
The cannot be deleted errors go away if I run the command again. Its like the folder WAS deleted, even though it gave an error.
I cant believe this is normal in Magento to go offline so I wonder if something is messed up on the website.