在装置依赖的时候,有时候npm i会很慢,甚至不胜利,谬误等等,其中起因之一就是间接应用npm外国源、国内拜访国外源网站的网络必定慢,所以卡顿

上面测试比照一下国外镜像源和国内阿里的淘宝源哪个速度快些。

镜像下载、域名解析、工夫同步请点击 阿里巴巴开源镜像站:https://developer.aliyun.com/...

先用国外镜像源

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

查看是否更换

npm config get registry

装置依赖试下速度

npm i

如图

用了8秒左右

在换上 阿里巴巴开源镜像站-OPSX镜像站里的淘宝 NPM 镜像

npm config set registry https://registry.npmmirror.com
查看是否更换

npm config get registry
装置依赖

npm i
如图

用了5秒左右,比国外源镜像快了不少,顺带一提的是淘宝NPM 镜像站切换新域名了

新的Web 站点:https://npmmirror.com,Registry Endpoint:https://registry.npmmirror.com。随着新的域名曾经正式启用,老 http://npm.taobao.org 和 http://registry.npm.taobao.org 域名将于 2022 年 05 月 31 日零时起进行服务

所以之前用这个

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

切换的记得改下源哦

改成

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