How to run two different nodejs applications with two different node versions simultaneously
Docker is the best choice to to run two different nodejs applications with two different nodejs versions simultaneously.
If not familiar with Docker, we can use the tool nvm in this situation.
nvm (node version manager) is a tool used for install and manage different versions of nodejs. Using ths tool we can install and manage multiple versions of nodejs in together.
Once the nvm installation completed, we can use the following command to run the application.
#nvm run <version> app.js
Here should replaced with the required version of nodejs.
Please note that this command is starting the application in foreground and will be terminated once the shell closed.
We can use the forever module in nodejs to run the applications in background.
#forever start -c ~/.nvm/v<version>/bin/node app.js
Here should replaced with the required version of nodejs.
That's all…