NVM

Page content

What’s nvm

  • Node.js Version Manager.
  • Like pyenv in Python.
  • Different from Python, you can’t label a name to the environment. package.json manage the libraries.

Install nvm

Follow the official document.

https://github.com/nvm-sh/nvm

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

..... (simple results)

$ export NVM_DIR="$HOME/.nvm"
$ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
$ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Check.

$ nvm --version
0.38.0

Change version

# List all available versions
nvm ls-remote

# Use latest version
nvm install node # "node" is an alias for the latest version
nvm use node

# Use speccific version
nvm install 14.0.0
nvm use 14.0.0

# set default version
nvm alias default 15.13.0