1

I have two project in Node.js

like

  1. projectA (work with node -V0.10.25)

  2. projectB (work with node -V0.12.5)

How can i handle this, that at a time projectA run with node version V0.10.25 and projectB with node version v0.12.5

1 Answer 1

4

Make Use of Node Version Manager like n or nvm.

https://www.npmjs.com/package/n

Install n node version manager using npm

npm install n -g

Then install node binaries for n

n 0.10.25
n 0.12.5

Then run your project using n with specific version

n use 0.10.25 projectAServer.js

n use 0.12.5 projectBServer.js
Sign up to request clarification or add additional context in comments.

5 Comments

i am running with forever then how will i handle it
you can find the node binary by using "n bin 0.10.25"
and Use forever start -c /usr/local/n/versions/node/0.10.25/bin/node projectAServer.js
thanks @Hiren but can you tell me why we are using -c and can you share me link where i can read more about this.
-c is used for which program to run. As per documentation npmjs.com/package/forever, it runs node. By defining -c we told forever to run this command (/usr/local/n/versions/node/0.10.25/bin/node) with argument ( projectAServer.js)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.