未更改的文件正在触发 nodemon 重新启动

Files that are not changed are triggering nodemon restarts

我在 Windows 上使用 handlebars 和 nodemon。我注意到(当对 nodemon 使用 debug 参数时),hbs 文件 - 即使它们没有被编辑 - 也会触发 nodemon 更改。

文件真的在改变吗?如果我不编辑它们,为什么它们会发生变化?

[11:22:46] [nodemon] files triggering change check: ..\forgot-sent.hbs
[11:22:46] [nodemon] matched rule: C:\Users\me\Documents\myapp\views/**/*
[11:22:46] [nodemon] changes after filters (before/after): 1/1
[11:22:46] [nodemon] restarting due to changes...
[11:22:46] [nodemon] views\forgot-sent.hbs

如何让nodemon在文件改变时刷新,文件不改变时不刷新?

编辑:看起来像是 nodemon/Windows 上的错误,请参阅 https://github.com/remy/nodemon/issues/1208

在命令后添加文件扩展名 nodemon 作为...

nodemon -e 'js|handlebars|hbs|html'

-e 指定要跟踪的扩展

如果您使用其他模板引擎作为'js|ejs|hbs',您可以添加不同的文件类型。

这是一个 bug in nodemon(或者更具体地说,chokidar,nodemon 的依赖项)

It was fixed on Feb 8 2019

升级到 the latest nodemon 以获得修复。