What is nvm βοΈ
π nvm
allows you to quickly install and use different versions of node via the command line.
How to install nvm βοΈ
π 1. using CURL
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
π 2. 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.
π 2. 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
πReference nvm-sh github README
π Follow me π
π Medium β«οΈ βΌ βͺοΈ Millan Kaul βͺοΈβΌβ«οΈ
LinkedIn π΅ π· πΉMillan KaulπΉ π· π΅ π