nodejs实时的检测系统文件的变化(无需重启服务)

1、安装superior

npm -g install supervisor

注意 superior必须全局安装,否则错误命令会提示安装到全局

2、修改启动

现在我们需要使用 supervisor app.js 来启动程序,而不是使用node app.js来启动程序

 把 package.json 的 "start": "node ./bin/www"  修改为 "start": "supervisor ./bin/www"

 如下所示:

"scripts": {
    "start": "node ./bin/www"
  },

修改为
  "scripts": {
    "start": "supervisor ./bin/www"
  },

 

3、使用npm start来启动系统

访问http://localhost:3000即可


posted @ 2019-02-27 15:55  webnote  阅读(769)  评论(0编辑  收藏  举报