nodejs版本管理工具。可以在多个nodejs版本中进行切换,降低了升级nodejs时的成本。
项目主页:https://github.com/creationix/nvm
安装方式:1、
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
2、
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
3、
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
安装完毕执行:
source ~/.nvm/nvm.sh
使用方法概述:
To download, compile, and install the latest v0.10.x release of node, do this:
nvm install 0.10
And then in any new shell just use the installed version:
nvm use 0.10
Or you can just run it:
nvm run 0.10 --version
Or, you can run any arbitrary command in a subshell with the desired version of node:
nvm exec 0.10 node --version
You can also get the path to the executable to where it was installed:
nvm which 0.10
In place of a version pointer like "0.10", you can use the special default aliases "stable" and "unstable":
nvm install stable nvm install unstable nvm use stable nvm run unstable --version
If you want to install io.js:
nvm install iojs
If you want to use the system-installed version of node, you can use the special default alias "system":
nvm use system nvm run system --version
If you want to see what versions are installed:
nvm ls
If you want to see what versions are available to install:
nvm ls-remote
To restore your PATH, you can deactivate it.
nvm deactivate
To set a default Node version to be used in any new shell, use the alias 'default':
nvm alias default stable
To use a mirror of the node binaries, set $NVM_NODEJS_ORG_MIRROR
:
export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 0.10 NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 0.10
To use a mirror of the iojs binaries, set $NVM_IOJS_ORG_MIRROR
:
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3 NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
nvm use
will not, by default, create a "current" symlink. Set $NVM_SYMLINK_CURRENT
to "true" to enable this behavior, which is sometimes useful for IDEs.