1 minute read


Written by - Millan Kaul


What is nvm ❓️

nvm allows you to quickly install and use different versions of node via the command line.


Image showing various nvm version

nvm managing multiple node versions

How to install nvm ❓️

  1. using CURL
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  1. using wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

The script clones the nvm repository to ~/.nvm


How to verify installation of nvm❓️

  1. nvm way
$ command -v nvm
nvm

👆 which should output nvm if the installation was successful.


If you get nvm: command not found or see nothing as 👆 simply close your current terminal, open a new terminal, and try verifying again.

  1. Traditional way
$ nvm -v
0.39.1


💚💚💚💚💚💚 NODE 💚💚💚💚💚💚


How to Install the latest version of node ❓️ [Feb 2022]

nvm install node

$ nvm install node 
Downloading and installing node v17.5.0...


How to list node versions (-> shows default version in use ) ❓️

nvm ls

$ nvm ls
->    v16.8.0  
      v17.5.0


How to update / change / default a specific node version❓️

nvm use v17.5.0

$ nvm use v17.5.0
Now using node v17.5.0 ....


How to confirm if new defaulted version is set correctly❓️

nvm ls

$ nvm ls
       v16.8.0  
->     v17.5.0


How to run app.js using a non default version ( lets say 16.8.0)❓

nvm run 16.8.0 app.js

$ nvm run 16.8.0 app.js


How to remove a specific / broken node version using nvm❓️

nvm uninstall v16.8.0

$ nvm uninstall v16.8.0 

Uninstalled node v16.8.0


How to confirm if that was removed successfully❓️

nvm ls

$ nvm ls
->     v17.5.0


<hr>

🙏 reference nvm-sh github README