nvm
nvm is a node version management tool. In order to solve the incompatibility of various versions of node, nvm is a tool that allows you to install and switch different versions of node on the same machine.
nvm install
Before installing nvm, you first need to uninstall node/npm installed on your computer.
Windows nvm installation download nvm-windows
https://github.com/coreybutler/nvm-windows/releases
MacOS install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.37.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.37.0/install.sh | bash
install node/npm
Order:
- nvm ls-remote: List all node version numbers that can be installed
- nvm install v15.1.0: install node with specified version number
- nvm use v15.1.0: switch node version, this is global
- nvm current: current node version
- nvm ls: list all installed node versions
update nvm
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"