nvm的下载、配置以及使用
Jacky
JavaScript
2023-06-03
237
下载地址
https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-setup.zip
设置国内镜像地址
在nvm的安装路径下,找到 settings.txt 文件并打开,在后面加入下面两行,设置国内镜像地址
node_mirror: https://npm.taobao.org/mirrors/node/ npm_mirror: https://npm.taobao.org/mirrors/npm/
node_global、node_cache 设置
在nvm的安装路径下,新建 node_global、node_cache 两个文件夹用于存放全局包和一些缓存内容
相关镜像源配置
npm
# 查看源
npm get registry
npm config get registry
# 临时修改
npm --registry https://registry.npmmirror.com install any-touch
# 永久修改
npm config set registry https://registry.npmmirror.com
# 还原
npm config set registry https://registry.npmjs.org
nrm
# 安装 nrm
npm install -g nrm
# 列出当前可用的所有镜像源
nrm ls
# 使用淘宝镜像源
nrm use taobao
# 测试访问速度
nrm test taobao
pnpm
# 安装 pnpm
npm install -g pnpm
# 查看源
pnpm get registry
pnpm config get registry
# 临时修改
pnpm --registry https://registry.npmmirror.com install any-touch
# 永久修改
pnpm config set registry https://registry.npmmirror.com
# 还原
pnpm config set registry https://registry.npmjs.org
yarn
# 安装 yarn
npm install -g yarn
# 查看源
yarn config get registry
# 临时修改
yarn add any-touch@latest --registry=https://registry.npmjs.org/
# 永久修改
yarn config set registry https://registry.npmmirror.com/
# 还原
yarn config set registry https://registry.yarnpkg.com
yrm
# 安装 yrm
npm install -g yrm
# 列出当前可用的所有镜像源
yrm ls
# 使用淘宝镜像源
yrm use taobao
# 测试访问速度
yrm test taobao