node.js - nodemon 递归监视问题?

标签 node.js express nodemon

我已经使用命令安装了 nodemon:

npm install nodemon -g

完成后,我将 "start": "node ./bin/www" 更改为 "start": "nodemon ./bin/www"

控制台中运行 npm start 的输出:

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `nodemon  ./bin/www ./bin/www`
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `nodemon  ./bin/www ./bin/www ./bin/www`
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `nodemon  ./bin/www ./bin/www ./bin/www ./bin/www`
and so on....

我哪里错了?请记住,这是我在 nodejs 上的第三天,所以请保持简单。

编辑

 "scripts": {
    "start": "nodemon app.js"
  },

enter image description here

enter image description here

“nodemon app.js”似乎可以工作,因为控制台没有显示任何错误,但我无法运行该应用程序。但是,如果我将其改回 node ./bin/www 它将起作用。

最佳答案

尝试降低要求。 这对我有帮助。

npm install nodemon@1.0.0 -g

我在 docker 镜像 (node:alpine) 中用 nodemon >1.2.0 100% 重现了这个问题。而且v1.1.0和v1.2.0也有一些奇怪的问题。

我只检查了次要版本(没有检查补丁级别,例如 1.2.1、1.2.2 和其他版本)

所以。 1.0.0 很旧,但效果很好。

在我的主机 Mac 上,我全局安装了 nodemon@1.11.0。 有时我有这个问题,有时我没有。 这与 pwd 和 nodemon.json 文件有某种联系。但我不确定。

我找到了一个 bug report与此问题相关。

关于node.js - nodemon 递归监视问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42318030/

相关文章:

node.js - Nodejs 上的多个 setTimeouts

node.js - 尝试结束 Express js 路由中的代码执行

node.js - mustache-js View 不会使用 nodemon 自动刷新

Angular 构建错误 "..has no exported member ' ɵReflectorReader'。”

node.js - 将 Google 功能与 Node-express-passport 结合使用

windows - 在 Windows 启动时启动 Node.js 文件的最佳方式

Node.js Express Passport Cookie 过期

node.js - 通过将 useNewUrlParser 设置为 true 来避免 "current URL string parser is deprecated"警告

json - 访问正文参数 NodeJS Express

python - 呃!堆栈错误: Command failed: python2 -c import platform;