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.
Is there anyway to run my pm2 on node v0.11 without changing the global node version? Thanks
yes, you need to install it globally.
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
or
sudo pm2 start app.js --interpreter=/home/ken/.nvm/v7.4.0/bin/node
etc..
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'
To run several version at the same time. In pm2
, you can use the --interpreter
options and specify the path to the node version you want.
If you use n
for version run n bin v4.2.0
to get the path to this node version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With