有几种方式可以切换 yarn 到国内镜像,
第一种方式,
yarn config get registry #查看 registry
yarn config set registry #设置 registry
第二种,通过 yrm
cnpm i yrm -g #通过 cnpm 全局安装
yrm ls,
yrm ls
npm ----- https://registry.npmjs.org/
cnpm ---- http://r.cnpmjs.org/
taobao -- https://registry.npm.taobao.org/
nj ------ https://registry.nodejitsu.com/
rednpm -- http://registry.mirror.cqupt.edu.cn
skimdb -- https://skimdb.npmjs.com/registry
yarn ---- https://registry.yarnpkg.com
通过 yarn config get registry 看有没有生效,
如果没有生效,看看项目根目录中有没有这个文件 .yarnrc
# Using the official mirror source
# registry "https://registry.yarnpkg.com"
把配置的源去掉即可。
网友评论