Vscode-live-server: CSS Mime type error

Created on 10 Sep 2018  路  6Comments  路  Source: ritwickdey/vscode-live-server

I'm submitting a Bug report

Current behavior

Refused to apply style from 'http://127.0.0.1:5500/website/display/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
When loading a CSS file I get an error like above, and the stylesheet doesn't load.

Expected

Mime type of the CSS file would be text/css instead of text/html. It might be a good idea to use the mime-type npm package to dynamically assign the style.

Environment

  • Chrome (desktop) version 69.0.3497.81
  • Live Server: 5.1.1
  • Platform: Windows 10 Home 64bit
  • Visual Studio Code: 1.26

Most helpful comment

Update

The type was text/html because that was a 404 error. My bad 馃

All 6 comments

Update

The type was text/html because that was a 404 error. My bad 馃

For unsupported stylesheet MIME type error. Please check the network tab. This usually happens when there is a typo in file/path name. The browser gets 404 error in response which cannot be applied like css.

Another thing to keep in mind: after you fix the path, you might need to do a hard reload in your browser (ctrl/cmd+shift+R in Chrome) to bypass cache.

Most of the time people get CSS MIME error could be because of the wrong path of css file in your code

I renamed style.css with styles.css
Problem solved for me.

Thank you @krupenja your comment saved me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Missangay picture Missangay  路  7Comments

yzhang-gh picture yzhang-gh  路  5Comments

tehsy97 picture tehsy97  路  6Comments

GaoHengdong picture GaoHengdong  路  4Comments

mpower02 picture mpower02  路  6Comments