Hi,
Suddenly CSS is not loading on my Magento 2 admin panel. The frontend is working fine.
Error details:
1. "Refused to apply style from 'https://www.ornativa.com/pub/static/version1502029409/adminhtml/Magento/backend/en_US/css/styles-old...' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."
2. "Uncaught SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at callback ((index):68)
at Object.execCb (require.js:1650)
at Module.check (require.js:866)
at Module.<anonymous> (require.js:1113)
at require.js:132
at require.js:1156
at each (require.js:57)
at Module.emit (require.js:1155)
at Module.check (require.js:917)"
The mime type is HTML is a bit of a misnomer. While that is the problem, the actual problem is that your the URL for CSS is returning a web server or Magento error rather than the CSS file it's mean to.
If you visit the URL that you shared https://www.ornativa.com/pub/static/version1502029409/adminhtml/Magento/backend/en_US/css/styles-old..., you get a Magento error page.
The CSS seems to be working on the frontend so not sure why it wouldn't be on admin, have you changed anything here recently. Can you regenerate the static files using the instructions on http://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-static-view.html to see if that helps.
If it doesn't, the next step would be see if you can find the file it's trying to load on the filesystem. If it's there, it would point to a web server configuration problem instead.
As for the second part of the issue, you should have a closer look at what JSON returns, search for an error in it and where it comes from.
Recently had a very similar issue with a Magento 2 site. Managed to track down the issue to a very import .htaccess file being missing in the pub/static folder on the server.
Re-adding this file from a clean Magento 2 installation rectified the issue.
Hello,
It is happen when CSS file is not there, please create same name file or do static content deploy for same.
Hi, could you pls explain briefly.
Hello @Jeeva Rathinam
Some time CSS created based on setting, so may be you need to go to that theme setting and save it so it will create that file.( e.g porto doing same thing)
Go into your dir /magento/pub/static/version1525190041/adminhtml/Magento/backend/en_US/css/ and you will find
'styles-old.css' - remove the 'old'.
Thank you very much. It worked for me, because of porto-theme!
You are my saviour. If I could buy you a beer, I would.