nodemon递归监视问题?

Sam*_*ack 6 node.js express nodemon

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

npm install nodemon -g
Run Code Online (Sandbox Code Playgroud)

做完,我改变"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....
Run Code Online (Sandbox Code Playgroud)

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

编辑

 "scripts": {
    "start": "nodemon app.js"
  },
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

在此处输入图片说明

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

mat*_*att 0

您不需要告诉nodemon要观看哪个文件夹。您只需要告诉它运行您的主应用程序,它就会自动监视所有嵌套的文件夹和文件。

例如。nodemon app.js(如果 app.js 是您的应用程序)

还。您可以选择nodemon.json在应用程序主体中创建一个文件来保存 nodemon 的配置信息。与你的问题不太相关。但很高兴拥有:)

这是我的样子:

{
  "ignore": ["data/*.json", "/node_modules/", "README.md"]
}
Run Code Online (Sandbox Code Playgroud)