Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forever: With two node versions installed, specify a node version to run with

I need 2 versions of NodeJS to run two different applications. One version is available in the default path so I can run it by calling node. The other version is installed at ~/node-v10/bin/node.

When I do forever start app.js, it's started with the first version. I

How do I start a forever script with the second node version? Forever doesn't appear to have a configuration to allow me to specify the node path.

I've tried this, but it doesn't work. Forever still starts with the old version:

NODE_PATH=~/node-v10/bin/node forever start app.js
like image 727
HyderA Avatar asked Apr 26 '13 06:04

HyderA


1 Answers

You can also use -c to specify the command:

forever start \
  -c /opt/node-0.8.22-1e7b3d5/bin/node \
  /var/www/app/server.js

-c defaults to node, so normally forever will just use the first node in the $PATH.

like image 184
Alan Ivey Avatar answered Oct 13 '22 20:10

Alan Ivey