如何實現(xiàn)nodejs程序更改后服務(wù)自動重啟
- 實現(xiàn)安裝nodemon的命令
npm install -g nodemon
- 實現(xiàn)安裝到本地的命令
npm install nodemon --save
- 在項目目錄下創(chuàng)建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-設(shè)置重啟模式
ignore-設(shè)置忽略文件
verbose-設(shè)置日志輸出模式客蹋,true詳細(xì)模式
- execMap設(shè)置運行服務(wù)的后綴名與對應(yīng)的命令
{
"js": "node-harmony"
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者