如何更改nodemon默认启动文件?
How to change nodemon default start file?
我有一个网络应用程序。我想用它来使用 nodemon。要启动我的应用程序需要 运行 'node ./bin/www',但 nodemon 默认 运行 另一个文件。我的网络应用程序不可用。
当我输入cmd时
nodemon
我得到了:
[nodemon] 1.14.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
但我想将默认启动文件从 node app.js
更改为 node ./bin/www
我该怎么做?
package.json
{
"name": "loc8r",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.18.2",
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"express": "~4.15.5",
"jade": "~1.11.0",
"mongoose": "4.13.9",
"morgan": "~1.9.0",
"nodemon": "^1.14.9",
"readline": "1.3.0",
"request": "^2.83.0",
"serve-favicon": "~2.4.5"
},
"main": "app.js",
"devDependencies": {},
"author": "",
"license": "ISC",
"description": ""
}
nodemon 应该获取 "main": "file_to_be_executed.js",
中的所有文件,因此如果 www 是您要执行的文件,请将:"main": "app.js",
更改为:"main": "./bin/www",
我有一个网络应用程序。我想用它来使用 nodemon。要启动我的应用程序需要 运行 'node ./bin/www',但 nodemon 默认 运行 另一个文件。我的网络应用程序不可用。
当我输入cmd时
nodemon
我得到了:
[nodemon] 1.14.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
但我想将默认启动文件从 node app.js
更改为 node ./bin/www
我该怎么做?
package.json
{
"name": "loc8r",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.18.2",
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"express": "~4.15.5",
"jade": "~1.11.0",
"mongoose": "4.13.9",
"morgan": "~1.9.0",
"nodemon": "^1.14.9",
"readline": "1.3.0",
"request": "^2.83.0",
"serve-favicon": "~2.4.5"
},
"main": "app.js",
"devDependencies": {},
"author": "",
"license": "ISC",
"description": ""
}
nodemon 应该获取 "main": "file_to_be_executed.js",
中的所有文件,因此如果 www 是您要执行的文件,请将:"main": "app.js",
更改为:"main": "./bin/www",