如何在特定节点版本上运行pm2? [英] How can I run pm2 on a certain node version?

查看:120
本文介绍了如何在特定节点版本上运行pm2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的linux服务器上运行着几种不同版本的节点,而我的服务基于节点v0.11.14.但是,其他人的代码必须在较低版本的node(低于v0.11)上运行,否则他们的服务将无法使用.因此,我无法将全局节点版本定义为v0.11.我只想运行pm2来监视基于节点v0.11的服务.

There are several different versions of node running on our linux server, And my service is based on node v0.11.14. However, other people's code have to run on lower version of node(lower than v0.11) otherwise their services will be out of service. So I can't define the global node version as v0.11. I just want to run pm2 to monitor my service based on node v0.11.

是否在不更改全局节点版本的情况下在节点v0.11上运行我的pm2?谢谢

Is there anyway to run my pm2 on node v0.11 without changing the global node version? Thanks

推荐答案

使用pm2并使用带有节点版本绝对路径的--interpreter标志指定节点版本:

Use pm2 and specify node version using --interpreter flag with node version absolute path:

sudo pm2 start app.js --interpreter=/home/ken/.nvm/v4.4.2/bin/node

sudo pm2 start app.js --interpreter=/home/ken/.nvm/v7.4.0/bin/node

等.

如果您在我提到的--interpreter="***.."位置更改了节点版本,则该应用将以确切的节点版本运行.

If you change the node version wherever I mentioned --interpreter="***.." the app will run in exact node version.

完成上述方法以验证是否使用以下命令

Once you completed the above approach to verify use following command

sudo pm2 show 'app name'

这篇关于如何在特定节点版本上运行pm2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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