简体   繁体   English

面对有关Atom和NodeJS中的实时服务器的问题

[英]Facing problem regarding live-server in Atom and NodeJS

I want to set a live environment for my web application. 我想为我的Web应用程序设置一个实时环境。 I'm using AngularJS and NodeJS (MEAN) and I want both to run live simultaneously. 我正在使用AngularJS和NodeJS(MEAN),并且我希望两者同时运行。 What I did is, I installed live-server through npm and started server by 我所做的是,我通过npm安装了实时服务器,并通过以下方式启动了服务器

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. 拒绝应用来自“ http://192.168.XX.XX:9999 / main.css ”的样式,因为它的MIME类型('text / html')不是受支持的样式表MIME类型,并且启用了严格的MIME检查。

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. 其次,尝试缩小css文件。

It was just the other index.html file i placed outside the public folder. 那只是我放置在公用文件夹之外的另一个index.html文件。 By the way, one solution worked for me. 顺便说一句,一种解决方案为我工作。

Place this link in the head of your HTML. 将此链接放在HTML的头部。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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