npm和yarn 切换淘宝镜像

373 阅读1分钟

npm和yarn 切换淘宝镜像

大家是否有下载包丢失的情况,有创建项目因为网络原因失败的情况,有就用吉格格

原因呐,就是npm和yarn的自带镜像是国外的,所以呐,就要科学上网啦,但是本人又穷,所以就切换淘宝镜像啦。

淘宝镜像现在有了新地址,旧地址自2022.05.31开始。官方就不再维护了。

NPM

查询当前镜像

 npm get registry

设置为淘宝镜像

 npm config set registry https://registry.npm.taobao.org/        (旧地址)
 npm config set registry https://registry.npmmirror.com/         (最新地址)

设置为官方自带镜像

 npm config set registry https://registry.yarnpkg.com

yarn

查询当前镜像

 yarn config get registry

设置为淘宝镜像

 yarn config set registry https://registry.npm.taobao.org/        (旧地址)
 yarn config set registry https://registry.npmmirror.com/         (最新地址)

设置为官方自带镜像

 yarn config set registry https://registry.yarnpkg.com