How Run Different Versions of Node.Js in Same Time

How to run two different nodejs applications with two different node version

You can use docker to run multiple Nodejs version simultaneously.
this might be useful for you:
https://nodesource.com/blog/containerizing-node-js-applications-with-docker

https://blog.hasura.io/an-exhaustive-guide-to-writing-dockerfiles-for-node-js-web-apps-bbee6bd2f3c4/

There are other useful resources available on the internet on containerizing Node app on docker.

Docker could be a better choice here but if you don't want to use docker, you can use the nvm run command to target specific versions without switching the node variable:

nvm run 4.8.3 nodeapp1.js

For the other node version :

nvm run 10.15.1 nodeapp2.js

Using forever :

forever start -c /home/ubuntu/.nvm/v10.15.3/bin/node nodeapp1.js

forever start -c /home/ubuntu/.nvm/v4.8.3/bin/node nodeapp2.js

How run different versions of node.js in same time?

As hobbs said in his comment, nvm is the way to go, since it was made specifically for this.

Check out this nice article on how to set it up/use it with different versions: http://codetheory.in/using-node-version-manager-nvm-to-manage-multiple-node-js-versions/

Check rebrec's comment below for instructions on how to use nvm

Running two node.JS servers simultaneously with different versions on a windows machine

(nvm maintainer here)

For Windows, these are your options:

  1. use real nvm, but on BashOnWindows/Windows Subsystem for Linux
  2. use an alternative: nvm-windows, nvs, ps-nvm, to name a few

How to use Multiple versions of Node on a single machine?

You can install NVM to install multiple version of node and switch between them :
https://github.com/nvm-sh/nvm

Two different projects on the same system, with different node versions

Assuming you are limited to a single server, ideally you would run each application in its own Docker container, keeping node versions isolated.

If this is not an option, you can use the nvm run command to target specific versions without switching the node variable:

For your angular app:

nvm run 4.2.0 your-angular-app.js

For the other app:

nvm run 8.11.3 your-other-app.js


Related Topics



Leave a reply



Submit