简体   繁体   中英

Facing problem regarding live-server in Atom and NodeJS

I want to set a live environment for my web application. I'm using AngularJS and NodeJS (MEAN) and I want both to run live simultaneously. What I did is, I installed live-server through npm and started server by

live-server --`host=192.168.XX.XX --port=9999`

It is showing the following error:

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

Also tried giving the path to my project folder in public by

live-server --`host=192.168.XX.XX --port=9999` --open=public

but facing same error. Please help! Thankyou

First I would check to see if you have a typo in the path name in the script tag. If you have an extra / in the name then you will get this error.

Second, try minifying the css file.

It was just the other index.html file i placed outside the public folder. By the way, one solution worked for me.

Place this link in the head of your HTML.

<base href="/" target="_blank">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM