nodemon node环境热启动工具

版权声明:多总结,帮助自己的同时也在帮助别人!留下意见和看法,让技术动起来! https://blog.csdn.net/qiphon3650/article/details/84864898

参考文章https://strongloop.com/strongblog/comparison-tools-to-automate-restarting-node-js-server-after-code-changes-forever-nodemon-nodesupervisor-nodedev/

常用工具

forever
// Installation: (安装)
sudo npm install -g forever
// Use forever -w, instead of node to start your app : (使用)
$ forever -w app.js

nodemon
// Installation:
sudo npm install -g nodemon
//Use nodemon, instead of node:
$ nodemon app.js
//You can also specify a custom list of file extensions to watch for with the -e switch like so:
$ nodemon -e ".coffee|.js|.ejs" app.js

supervisor
// Installation:
sudo npm install -g supervisor
// Use supervisor, instead of node:
$ supervisor app.js
// Like nodemon, supervisor also allows you to specify your own list of files to watch with the -e switch like so, just without the dot:
$ supervisor -e "js|ejs|node|coffee" app.js

node-dev
 // Installation:
npm install -g node-dev
 // Use node-dev, instead of node:
$ node-dev app.js


//pm2   貌似已经不支持了

我用的是nodemon

配置可以写在package.json里感觉好喜欢

"nodemonConfig": {
    "delay" : "2500"  // 延迟执行参数
  }

// 更多关注
npx nodemon -h

猜你喜欢

转载自blog.csdn.net/qiphon3650/article/details/84864898