npm设置淘宝镜像

41,208 阅读1分钟

npm设置淘宝镜像

更新

淘宝镜像源最新地址

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

我们通过npm install xxx 安装包的过程会特别慢,或者安装半天突然报错。这是因为npm镜像地址在国外,所以访问会慢有的时候还访问不到.....(天朝的万能的防火墙)

我们可以通过设置淘宝镜像来解决问题

淘宝镜像同步频率目前为10分钟一次以保证尽量与官方服务同步。

设置成淘宝镜像

// 旧地址2022年(今年)5月份停止解析
npm config set registry http://registry.npm.taobao.org

查看设置是否成功

npm get registry 

注意如果你换成淘宝镜像的话,会影响你发布模块,这时候需要换回npm官网的镜像

npm config set registry https://registry.npmjs.org