以mac下为例,前提:以安装gitgit
$ git clone git@github.com:creationix/nvm.git ~/.nvm $ source ~/.nvm/nvm.sh # 安装 $ nvm install v0.12.0 # 显示当前本地安装的全部 Node.js $ nvm ls # 显示服务器全部可用的 Node.js $ nvm ls-remote # 本地可用的 Node.js 中使用 0.12.0 $ nvm use 0.12.0 # 设置每次启动默认版本 $ nvm alias default 0.12.0
#查看正在使用的版本
$ nvm current
v0.10.24
以指定版本执行脚本github
$ nvm run 0.10.24 myApp.js
卸载nvmvim
$ rm -rf ~/.nvm
注意,若是重启终端后,出现nvm command not found
bash
解决方案:服务器
Check your .bash_profile
or .profile
file. You most likely had a problem during the installation.spa
You should have the following at the end of one of those files.code
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM
在当前用户的home目录里有个.bash_profile,若是没有建一个orm
touch .bash_profilerem
编辑.bash_profileget
vim .bash_profile