如何实现nodejs程序更改后服务自动重启
2019-08-08 本文已影响0人
繁络
如何实现nodejs程序更改后服务自动重启
- 实现安装nodemon的命令
npm install -g nodemon
- 实现安装到本地的命令
npm install nodemon --save
- 在项目目录下创建nodemon.json文件
{
"restartable": "rs",
"ignore": [
".git",
".svn",
"node_modules/**/node_modules"
],
"verbose": true,
"execMap": {
"js": "node --harmony"
},
"watch": [
],
"env": {
"NODE_ENV": "development"
},
"ext": "js json"
}
- 更多模式命令
restartable-设置重启模式
ignore-设置忽略文件
verbose-设置日志输出模式,true详细模式
- execMap设置运行服务的后缀名与对应的命令
{
"js": "node-harmony"
}

