nodemon 全局的安装:
npm install -g nodemon
安装完 nodemon 后,就可以用 nodemon 来代替 node 来启动应用
odemon 比较流行的原因之一就是它的可配置性比较高,下面是官网给出的配置文件 nodemon.json 的例子,加上我自己了解到的有用的一些配置,开发环境建议可以把每个参数都写上备用,生产环境就把没有必要的参数去掉,有些字段是可以在命令行模式以参数形式给出的,可以通过 -h 查看,下面逐个解释:
{
"restartable": "rs",
"ignore": [
".git",
"node_modules/**/node_modules"
],
"verbose": true,
"execMap": {
"": "node"
"js": "node --harmony"
},
"events": {
"restart": "osascript -e 'display notification \"App restarted due to:\n'