MAC:經過NVM安裝指定版本的node

一. 安裝NVM(前提是你安裝了homebrew)node

$ brew install nvm shell

二.在shell中可使用nvm命令npm

若是沒有.bash_profile文件須要自行touch .bash_profile哦vim

$ cd ~ bash

$ vim .bash_profile homebrew

而後添加如下命令:rem

export NVM_DIR=~/.nvmfile

source $(brew --prefix nvm)/nvm.sh終端

而後從新source下載

$ source .bash_profile

三. 使用nvm安裝node

$ nvm ls-remote 查看 全部的node可用版本

$ nvm install xxx 下載你想要的版本

$ nvm use xxx 使用指定版本的node 

$ nvm alias default xxx 每次啓動終端都使用該版本的node 

四. 完成安裝

$ node -v

$ npm -v 

相關文章
相關標籤/搜索