[英]What would cause npm live-server to stop detecting file changes?
This was working on my system and now is not. 这在我的系统上正在运行,但现在没有。 I have live-server version 0.8.1 installed globally.
我已经在全球范围内安装了实时服务器版本0.8.1。
npm install live-server -g
But when I start it I don't get the "Live reload enabled." 但是,当我启动它时,并没有启用“实时重新加载”。 message in the browser console.
浏览器控制台中的消息。
I've uninstalled it completely and re-installed it to no avail. 我已经完全卸载了它,但是重新安装却无济于事。
The http server is working. http服务器正在运行。 It will serve up my index.html and all related content.
它将提供我的index.html和所有相关内容。 It just won't detect file changes.
它只是不会检测文件更改。
Starting live-server: 启动实时服务器:
live-server --open=src
I'm using typescript outputting js to src/dist/... I've verified that the file is changing. 我正在使用将js输出到src / dist /的Typescript ......我已验证文件正在更改。 I can modify the js directly as well.
我也可以直接修改js。 In no case does live-server detect any changes.
实时服务器决不会检测到任何更改。
File system permissions? 文件系统权限? Cached configuration?
缓存配置?
What's causing this? 是什么原因造成的?
I had been having this issue as well, and stumbled across one exchange between Ritwick Dey (author of live-server), and a dev having the same issues. 我也一直遇到这个问题,偶然发现Ritwick Dey(实时服务器的作者)和一个有相同问题的开发人员之间发生了一次交流。
As it turns out, it's as simple as not using a self-closing tag. 事实证明,这就像不使用自闭标签一样简单。
In my case, I was using React, and the line in question (in my HTML file) was 就我而言,我使用的是React,相关的行(在我的HTML文件中)是
<script src="/scripts/app.js" />
Changing it to the following immediately fixed my issue, and got the "Live reload enabled" message in my Console, and hot reloading to work again. 将其更改为以下内容可立即解决我的问题,并在控制台中显示“启用实时重新加载”消息,然后重新进行热加载即可正常工作。
<script src="/scripts/app.js"></script>
Hope this helps. 希望这可以帮助。
(here's a link to the conversation: https://github.com/ritwickdey/vscode-live-server/issues/82 ) (这是对话的链接: https : //github.com/ritwickdey/vscode-live-server/issues/82 )
This may have been a Chrome caching issue. 这可能是Chrome缓存问题。 I opened Safari and voila, everything started working.
我打开Safari和voila,一切都开始工作了。 Closed Safari and now Chrome is working again.
关闭Safari,现在Chrome可以再次使用了。
I'm going to call this a bizarre environmental fluke. 我将这称为奇怪的环境environmental幸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.