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:
- use real
nvm
, but on BashOnWindows/Windows Subsystem for Linux - 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
Bash Script: Can Not Properly Handle Sigtstp
Git Error: Gpg Failed to Sign The Data on Linux
Atomically Swap Contents of Two Files on Linux
How to Detect If The Script Is Running on a Virtual Machine
Default Font Size of Javafx Under Linux Is Larger as on Windows
How to Zip Folder That Contains More Than 12Gb Data
How to Rewrite If File Not Found Using Nginx
How to Send Data Using Curl from Linux Command Line
How to Run Jprofiler from Windows Machine to Remote Linux Jvm
How Run Different Versions of Node.Js in Same Time
Compare Checksum of Files Between Two Servers and Report Mismatch
Copy N Bytes of Data X to File
Simplest Way to Build Dotnet Sdk Project Requiring Net461 on Macos
Using Git to Clone from a Windows Machine to a Linux Webserver (In House)