- 安装npm。
npm的项目地址:https://github.com/creationix/nvm/blob/master/README.markdown
直接从Github中将git clone nvm到本地。
$ cd ~/git$ git clone https://github.com/cnpm/nvm.git
配置终端启动时自动执行 source ~/git/nvm/nvm.sh, 在 ~/.bashrc, ~/.bash_profile, ~/.profile, 或者 ~/.zshrc 文件添加以下命令:
source ~/git/nvm/nvm.sh
重新打开你的终端, 输入 nvm
```$ nvmNode Version Manager Usage:nvm help Show this messagenvm --version Print out the latest released version of nvmnvm install [-s]Download and install a , [-s] from sourcenvm uninstall Uninstall a versionnvm use Modify PATH to use nvm run [ ] Run with as argumentsnvm current Display currently activated versionnvm ls List installed versionsnvm ls List versions matching a given descriptionnvm ls-remote List remote versions available for installnvm deactivate Undo effects of NVM on current shellnvm alias [ ] Show all aliases beginning with nvm alias Set an alias named pointing to nvm unalias Deletes the alias named nvm copy-packages Install global NPM packages contained in to current versionExample:nvm install v0.10.24 Install a specific version numbernvm use 0.10 Use the latest available 0.10.x releasenvm run 0.10.24 myApp.js Run myApp.js using node v0.10.24nvm alias default 0.10.24 Set default node version on a shellNote:to remove, delete or uninstall nvm - just remove ~/.nvm, ~/.npm and ~/.bower folders ```
-
通过 nvm 安装任意版本的 node
安装制定版本的nodejs
$ nvm install v6.7.0
查看本机的版本信息
$ nvm list
查看所有的nodejs版本信息
$ nvm list-remote
删除指定版本
$ nvm uninstall v6.6.0