Gangmax Blog

NVM: Node Version Manager

NVM” is the “node.js” equivalent as RVM for Ruby or pyenv for Python. The following code shows how to install and use it.

1
2
3
4
5
6
7
8
9
10
# 1. Install.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
# 2. List all available versions.
nvm ls-remote
# 3. Install a version.
nvm install v6.9.4
# 4. Use a specific version.
nvm use 6.9.4
# 5. Set the default node version if you have multiple versions.
nvm alias default node

More information can be found in the official document here.


Added on Dev 7th, 2021.

Some nvm daily commands are listed here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Update nvm.
cd ~/.nvm
git pull

# Check installed node versions.
nvm list

# Check the latest LTS(long term service) node versions.
nvm ls-remote --lts

# Install the latest lts version, which installs "v16.13.1" at this moment.
nvm install --lts

# Set the installed new lts version as the default one.
nvm alias default v16.13.1

# Remove the old version.
nvm uninstall v14.18.1

Comments