0
votes

I ran into a problem with applying stylesheet to my page in Node.JS project. I have a

app.use(express.static(__dirname + '/public'));

line in my app.js file, as well as public folder in the root of the project and css files in it. Maybe it has something to do with gulp, because before I installed it everything worked fine. In href I'm reffering /css/styles.css, which must work out. But the MIME type error is still present

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

Please, give me some advice????????

1

1 Answers

0
votes

Are you sure that your CSS file is served? It might happen if your /styles.css URL returns "404 Not Found".

You said that the CSS file is in /css/styles.css.

But your error says it refers to /styles.css

So my advice - check your URL. Check again. :)