用nvm安裝nodejs

先用git安裝NVMgit clone https://github.com/creationix/nvm.git .nvmnode

cd ~/.nvm and check out the latest version with git checkout v0.33.6git

Now add these lines to your ~/.bashrc~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)github

export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

以上出自https://github.com/creationix/nvm/blob/master/README.md#installation

執行nvm list-remote
選擇相應的版本

nvm install v8.7.0最後驗證下 node -versionnpm -version
相關文章
相關標籤/搜索