- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento 2 does not load css or js after setup: upgrade
After having done setup: upgrade, setup: static-content: deploy and setup: say: compile my web does not load the resources css or js.
First I placed my website in developer mode, I noticed that there were problems with a module and decided to update it, after running the aforementioned commands I began to have problems in the consistency of the web. Currently it loads some static files but all css and js indicate 404 error or MIME type ('text / html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
I have tried to change the web to production mode and deploy static content multiple times, however until now I have not been able to load all the content of my website.
I use Magento 2.3.1 in Centos 7
Any idea what might be causing this problem?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
Hello @luis_suarez2
These are the ways to resolve the issues:
- Check the error.log file of the server for any possible code issue in .htaccess. You can refer the solution at https://community.magento.com/t5/Magento-2-x-Technical-Issues/Magento-2-3-2-500-Internal-Error-CWP-C...
It will help with the 404 error. - To check if deploy is done properly, access the .css and .js with direct URLs.
- Remove the version code from the URL and check again. Refer https://devdocs.magento.com/guides/v2.2/config-guide/cache/static-content-signing.html for the same.
Upgrade and deploy again.
Flush cache.
It will resolve the issues.
Hope it helps.
If you've found my answer useful, please give"Kudos" and "Accept as Solution"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
Please check that .htaccess file is there in your pub/static directory or it is removed ?
Also please run below commands in sequence :
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento cache:clean php bin/magento cache:flush
Also refer this link for more solutions like you need to set proper permissions to pub directory - https://magento.stackexchange.com/questions/212514/refused-to-apply-style-because-its-mime-type-text...
Also please follow the steps mentioned by @Meetanshi
Hope it helps !
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
Hi, thank you very much for your answers. So far I have tried to replace the .htaccess files in the pub and pub / static folders, however I continue to receive the same error messages in both the css and the js. I have followed the steps proposed by Meetanshi, but the problem persists
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
As mentioned above i would suggest you to run those command in sequence like after compile run static-content:deploy -f command.
Also please give files and folders permissions again - here by i am sharing reference link for the same - https://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions
Hope it helps !
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
On the other hand, I also tried to look for the specific url of my js or css files and the following happens, those specific paths exist inside my server and lead to the correct files, however when I enter the url of the files in my browser I get Error 404
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2 does not load css or js after setup: upgrade
Hello, @luis_suarez2 again!
This link might be helpful too!
Thanks.
If you've found my answer useful, please give"Kudos" and "Accept as Solution"