brew install nvm // 使用nvm安装
~/.bash_profile
配置文件中加入:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
nvm ls // 查看已安装版本
nvm ls-remote //查看 所有的node可用版本
nvm install xxx //下载你想要的版本,eg:nvm install 8.1.2
nvm use xxx //使用指定版本的node
nvm alias default xxx //每次启动终端都使用该版本的node
nvm deactivate
nvm uninstall 8.1.2