install
Git Install
If you have git installed (requires git v1.7.10+)
- repo: github.com/nvm-sh/nvm.…
- clone this repo in the root of your user profile
cd ~/ from anywhere then git clone https://github.com/nvm-sh/nvm.git .nvm
- cd ~/.nvm and check out the latest version with git checkout v0.37.0
- activate nvm by sourcing it from your shell: . nvm.sh
- 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)
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
常用指令
- nvm ls 已经下载的版本
- nvm ls-remote 远程版本
- nvm install [版本号] 下载指定版本
- nvm use [版本号]
FQ
1. nvm install慢的问题?
// 命令行输入如下并回车
NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node