nodejs版本管理工具。能夠在多個nodejs版本中進行切換,下降了升級nodejs時的成本。
node
項目主頁:https://github.com/creationix/nvmgit
安裝方式:一、github
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
二、shell
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
三、bash
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
安裝完畢執行:curl
source ~/.nvm/nvm.sh
使用方法概述:工具
To download, compile, and install the latest v0.10.x release of node, do this:this
nvm install 0.10
And then in any new shell just use the installed version:url
nvm use 0.10
Or you can just run it:rest
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.