NodeJS 版本管理工具:nvm,fnm,volta
1. nvm
https://github.com/nvm-sh/nvm
Intro
nvm
allows you to quickly install and use different versions of node via the command line.
Example:
$ nvm use 16
Now using node v16.9.1 (npm v7.21.1)
$ node -v
v16.9.1
$ nvm use 14
Now using node v14.18.0 (npm v6.14.15)
$ node -v
v14.18.0
$ nvm install 12
Now using node v12.22.6 (npm v6.14.5)
$ node -v
v12.22.6
2. fnm
https://github.com/Schniz/fnm
Fast and simple Node.js version manager, built in Rust
Features
- Cross-platform support (macOS, Windows, Linux)
- Single file, easy installation, instant startup
- Built with speed in mind
- Works with .node-version and .nvmrc files
3. Volta
https://github.com/volta-cli/volta
https://volta.sh/
Features
- Speed
- Seamless, per-project version switching
- Cross-platform support, including Windows and all Unix shells
- Support for multiple package managers
- Stable tool installation—no reinstalling on every Node upgrade!
- Extensibility hooks for site-specific customization
export VOLTA_DEFAULT_NODEJS_MIRROR=https://mirrors.ustc.edu.cn/node/