Node/Express - Refused to apply style because its MIME type ('text/html')

This is not a solution for your question but this might help someone else searching for solution like me. if you use app.get like below:

app.get(express.static(path.join(__dirname,"public")));

change it to :

app.use(express.static(path.join(__dirname,"public")));

The problem is the result of an improperly named file. Our student had a space at the end of the style.css file. There were a few tip offs to this, the first was a lack of syntax highlighting in the text editor, and the second was the text editor detecting the filetype for other newly created css files but not the improperly named file. Removing the space resolved the issue.

Thank you slebetman for your help in pointing me in the right direction.


In Nodejs app with express, we need to add the line like below to tell the server about the directory

app.use(express.static(__dirname));

This will solve the problem of CSS not rendering