nvm快速入门
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
下载并配置
下载安装脚本并运行
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
NVM配置国内镜像
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
刷新环境变量
source ~/.bash_profile
检测是否安装成功
command -v nvm
升级 nvm
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"
基本用法
下载最新版本
nvm install node
下载指定版本
nvm install 8
列出全部远程可用版本
nvm ls-remote
nvm ls available
使用最新版本
nvm use node
使用指定版本
nvm use 8
列出已安装版本
nvm ls
npm 镜像
临时使用
npm install gitbook -g --registry https://registry.npm.taobao.org
永久使用
npm config set registry https://registry.npm.taobao.org
恢复使用
npm config set registry https://registry.npmjs.org
当前镜像
npm config get registry
fad
nvm is not compatible with the npm config "prefix" option: currently set to ""
参考资料
Last updated
Was this helpful?