Skip links

Node Version Manager – NVM

Node Version Manager is a great utility to manage different node versions on your machine. Once you have 4-5 different projects that require different node versions NVM helps you out by quickly switching between different node versions.

Github Link – https://github.com/nvm-sh/nvm

Installation is relatively very simple.

Macos

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Check if nvm is installed

command -v nvm

Commonly used nvm commands

nvm ls 
# list all available node versions 

nvm use 16 
# Now using node v16.9.1 (npm v7.21.1)

node -v
v16.9.1

nvm use 14
# Now using node v14.18.0 (npm v6.14.15)

node -v
v14.18.0

nvm install 12
# Now using node v12.22.6 (npm v6.14.5)

node -v
v12.22.6

Leave a comment