Nodemon is not working : [nodemon] restarting due to changes

北慕城南 提交于 2021-01-28 19:00:28

问题


I use nodemon as a dev-dependency in node. Suddenly, in CLI it shows:

[nodemon] restarting due to changes...

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:


回答1:


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


来源:https://stackoverflow.com/questions/61032383/nodemon-is-not-working-nodemon-restarting-due-to-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!