本文介绍了Nodemon 不工作:[nodemon] 由于更改而重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用
解决方案
可能是因为开始更新了服务器正在监视的文件,因此在无限循环中触发了重新启动事件.
Nodemon 支持 --watch
和 --ignore
命令.和他们一起玩,只观看一组特定的文件.示例:
# 只看server"目录nodemon --watch 服务器 server/main.js# 观察server"和client"目录nodemon --watch server --watch 客户端服务器/main.js# 查看server"目录,但忽略server/logs"nodemon --watch server --ignore server/logs server/main.js
I use nodemon as a dev-dependency in node. Suddenly, in CLI it shows:
when I am changing the code. Then I have globally installed nodemon but it still isn't working. It is not working on any project-- not a single project.
Any help? I have attached a screenshot of my CLI:
解决方案
It's probably because starting updates a file that the server is watching, therefore triggering a restart event in an infinite loop.
Nodemon supports the --watch
and --ignore
commands. Play around with them to only watch a certain set of files. Example:
# Only watch the "server" directory
nodemon --watch server server/main.js
# Watch both the "server" and "client" directory
nodemon --watch server --watch client server/main.js
# Watch the "server" directory, but ignore "server/logs"
nodemon --watch server --ignore server/logs server/main.js
这篇关于Nodemon 不工作:[nodemon] 由于更改而重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!