Published 2020-05-06
I have been using NVM (Node Version Manager) for quite some time. However, only recently I leverage nvm alias
to manage my node version.
Below is the command structure for node alias.
node alias customName nodeVesion
// Given Node v10.16.3 alias name of node-prod
nvm alias node-prod v10.16.3 // Node version use in production
nvm alias node-uat v12.16.3 // The upcoming version & currently testing in UAT environment.
nvm alias node-dev v14.1.0 // The latest version to play & experiment in Dev Environment
Besides, by giving a meaningful name enable you easily to switch between each node version instead of remembering the version.
// Change the current running nodejs version to v14.1.0
nvm use node-dev
After alias, you can easily switch between each node version using nvm use
Default behavior of NVM is always use the latest version of Node you have installed.
So this comes in handy when you want to set your default version to lower Node.js version.
nvm alias default node-prod
With this approach, I can