Node 多版本管理器(Node VersionManager,nvm)是一个通用的叫法,它目前有许多不同的实现。
我喜欢用n管理器,没错,名字就是一个字母n(https://github.com/visionmedia/n)
[livingbody@localhost etc]$ cnpm install -g n
Downloading n to /usr/local/node-v10.13.0-linux-x64/lib/node_modules/n_tmp
Copying /usr/local/node-v10.13.0-linux-x64/lib/node_modules/n_tmp/_n@2.1.12@n to /usr/local/node-v10.13.0-linux-x64/lib/node_modules/n
Installing n's dependencies to /usr/local/node-v10.13.0-linux-x64/lib/node_modules/n/node_modules
All packages installed (used 5ms(network 3ms), speed 0B/s, json 0(0B), tarball 0B)
[n@2.1.12] link /usr/local/node-v10.13.0-linux-x64/bin/n@ -> /usr/local/node-v10.13.0-linux-x64/lib/node_modules/n/bin/n
[livingbody@localhost etc]$
注意:不支持windows
[livingbody@localhost etc]$ n --help
Usage: n [options/env] [COMMAND] [args]
Environments:
n [COMMAND] [args] Uses default env (node)
n io [COMMAND] Sets env as io
n project [COMMAND] Uses custom env-variables to use non-official sources
Commands:
n Output versions installed
n latest Install or activate the latest node release
n -a x86 latest As above but force 32 bit architecture
n stable Install or activate the latest stable node release
n lts Install or activate the latest LTS node release
n <version> Install node <version>
n use <version> [args ...] Execute node <version> with [args ...]
n bin <version> Output bin path for <version>
n rm <version ...> Remove the given version(s)
n prune Remove all versions except the current version
n --latest Output the latest node version available
n --stable Output the latest stable node version available
n --lts Output the latest LTS node version available
n ls Output the versions of node available
(iojs):
n io latest Install or activate the latest iojs release
n io -a x86 latest As above but force 32 bit architecture
n io <version> Install iojs <version>
n io use <version> [args ...] Execute iojs <version> with [args ...]
n io bin <version> Output bin path for <version>
n io rm <version ...> Remove the given version(s)
n io --latest Output the latest iojs version available
n io ls Output the versions of iojs available
Options:
-V, --version Output current version of n
-h, --help Display help information
-q, --quiet Disable curl output (if available)
-d, --download Download only
-a, --arch Override system architecture
Aliases:
which bin
use as
list ls
- rm