PM2 是否打算在开发过程中使用? [英] Is PM2 meant to be used during development process?

查看:104
本文介绍了PM2 是否打算在开发过程中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 Node.js 世界开始,我注意到节点进程不会自动重启.

I'm starting with Node.js world and I noticed that node process doesn't restart automatically.

四处搜索我发现 nodemon 可以完成这项工作,但我也发现 PM2 是 nodemon 的替代品.那么我应该尝试使用 PM2 进行开发还是将其留作生产并使用 nodemon 进行开发(这似乎很容易设置)?

Searching around I found that nodemon can do that work but I also found that PM2 is an alternative to nodemon. So should I try PM2 for development or just leave it for production and use nodemon for development (which seems very easy to setup)?

推荐答案

节点进程应该重新启动,除非被告知这样做.您可以使用带有 watch 功能的 PM2 进行开发 - 与 nodemon 的结果类似.如果你想从你的 PM2 ecosystem.config.js 文件中传入一堆环境变量,我推荐 PM2.否则,我会像 @AKX 所说的那样使用 nodemon.

A node process should not restart unless told to do so. You can use PM2 for development with the watch feature - similar results to nodemon. I recommend PM2 if you want to pass in a bunch of environment variables from your PM2 ecosystem.config.js file. Otherwise, I’d use nodemon as @AKX said.

这篇关于PM2 是否打算在开发过程中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆