cancel
Showing results for 
Search instead for 
Did you mean: 

CSS/JS not loading in frontend/backend only in production mode

SOLVED

CSS/JS not loading in frontend/backend only in production mode

Hi all,

after spending some hours with this issue I now dare to ask. I think I have overseen something stupid. And yes, I i have all sorts of tutorials  read... My problem: Site is working properly in developer mode. After switching in production mode my, I run static content deploy command wich runs without any errors. But after that admin and frontend are missing all styles. Seems although deploy command works, static files are not written, pub/static is missing files and console error says require.config failed to load. strangely, I seem to have the opposite problem of those who have in the developer mode problems with the symlinks, because the developer mode with the symlinks works wonderfully, the symlinks are written without problems in pub / static. Version 2.1.7

Cheers, Stefan

1 ACCEPTED SOLUTION

Accepted Solutions

Re: CSS/JS not loading in frontend/backend only in production mode

Thank you for your answer, yes I first checked rights..... but sorry, I'm pretty stupid! But for everyone who is as stupid as I am, here is the simple solution: One must not forget its language. A simple setup: static-content: deploy is not enough, only the default language is provided. For example, explicitly setup: static-content: deploy en_US de_DE to fully create front and backend files in every language. Perhaps I should have read the documentation more often and better, perhaps also the Magento developers should have made such a point more clearly.

 

View solution in original post

3 REPLIES 3

Re: CSS/JS not loading in frontend/backend only in production mode

This may be permission issue for your var and pub/static folder. Please give full permission to your var and pub/static folder from root SSH.

 

After apply root permission to your system path run below command,

 

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:flush

Remove browser cache and check again.

 

if issue solved, Click Kudos/Accept as Solutions.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: CSS/JS not loading in frontend/backend only in production mode

Thank you for your answer, yes I first checked rights..... but sorry, I'm pretty stupid! But for everyone who is as stupid as I am, here is the simple solution: One must not forget its language. A simple setup: static-content: deploy is not enough, only the default language is provided. For example, explicitly setup: static-content: deploy en_US de_DE to fully create front and backend files in every language. Perhaps I should have read the documentation more often and better, perhaps also the Magento developers should have made such a point more clearly.

 

Re: CSS/JS not loading in frontend/backend only in production mode

my problem solved using above three commends

 

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:flush