Answers for "Refused to apply style from 'http://localhost:3000/css/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."

3

stylesheet not loaded because of mime-type

put your .css file in a folder called public
in your app.js file add the following code:

app.use(express.static('public'));
Posted by: Guest on November-04-2020
3

Refused to apply style from 'http://localhost:9000/public/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

For me the solution was: instead, app.use(express.static(__dirname + '/public'));

I have used: app.use(express.static(__dirname));

now everything working correctly
Posted by: Guest on April-25-2021
1

Refused to apply style from 'http://localhost:3000/css/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

app.get('/style.css', function(req, res) {
  res.sendFile(__dirname + "/" + "style.css");
});
Posted by: Guest on March-29-2021

Code answers related to "Refused to apply style from 'http://localhost:3000/css/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."

Code answers related to "Javascript"

Browse Popular Code Answers by Language