PM2 是否打算在开发过程中使用? [英] Is PM2 meant to be used during development process?
问题描述
我从 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屋!