问题解决记录

全局安装 运行找不到命令

npm bin -g # npm
yarn global bin #yarn
1
2

执行后 '复制' 打印的路径添加到系统环境变量 path

更改本地缓存仓库

npm config set cache "D:\Program Files\npm-cache"
npm config set prefix "D:\Program Files\npm_global"

#1.改变 yarn 全局安装位置
yarn config  set global-folder "D:\yarn\global"
yarn config set cache-folder "D:\yarn\cache"
1
2
3
4
5
6

查看npm配置

npm config list
yarn config list
1
2

修改镜像仓库

yarn config set registry  https://registry.npmmirror.com/
npm config set registry  https://registry.npmmirror.com/
1
2

镜像仓库

npm --- https://registry.npmjs.org/
npm ---  https://registry.npmmirror.com//
yarn --- https://registry.yarnpkg.com/
yarn ---  https://registry.npmmirror.com//
npm --- https://repo.huaweicloud.com/repository/npm/
cnpm --- https://r.cnpmjs.org/
taobao ---  https://registry.npmmirror.com//
nj --- https://registry.nodejitsu.com/
rednpm --- https://registry.mirror.cqupt.edu.cn/
npmMirror --- https://skimdb.npmjs.com/registry/
deunpm --- http://registry.enpmjs.org/
1
2
3
4
5
6
7
8
9
10
11

仓库管理工具

npm install -g nrm   //npm全局安装nrm
yarn add nrm -g    //yarn全局安装nrm
1
2

nrm常用命令

nrm ls # 查看仓库
nrm use [镜像名] # 更改仓库地址 
nrm test  # 测速(不带镜像名称的所有仓库都会跑一遍)
1
2
3