Run multiple node versions on Windows with Node Version Manager (NVM). But why would you need that?
An application is running on Node 8.x.x on a build agent(machine) and in the meantime, we developed the new application which needs to share the same build agent and it requires a higher node version. In this scenario, what should be our further course of action?
There is a tool that helps to maintain multiple node versions on the same machine known as NVM.
Before installing NVM make sure you don’t have node js installed on your machine. If it is installed, uninstall Node.js and also remove the C:\Program Files\nodejs folder.
“NVM for windows https://github.com/coreybutler/nvm-windows/releases”
Step 1: Download and Install NVM from the above link.
Step 2: After installation open command prompt and verify the version
Step 3: verify available versions in NVM.
nvm ls available
Note: You can’t find any available versions on your machine. Below available versions are part of NVM.
Step 4: Install and switch between two node versions.
nvm install 8.9.4 64 — Installs node.js 8.9.4 version as 64x
nvm install 10.15.0 64 — Installs node.js 10.15.0 version as 64x
Step 5: To verify the list of available versions on your machine.
nvm list — shows available versions installed by nvm
If you want to use specific version nvm use version number
NVM in build pipeline, if two different applications require different Node js version, then as per the configuration, the application will use whichever version it requires.
In the next blog, I’ll write about how to configure NVM in your Build pipeline