使用nrm快速切换npm镜像源/手动切换npm镜像源

使用nrm快速切换npm镜像源/手动切换npm镜像源

0.nrm管理

什么是nrm
nrm 是一个 npm 源管理器,允许你快速地在 npm 源间切换。

全局安装nrm
npm install -g nrm

查看可选的源
nrm ls

20240122003326235-image

 

切换
根据上述命令所显示出来的镜像源的名称切换,如果要切换到taobao源,则执行命令

nrm use taobao

测试延迟,可以先测试延迟,看自己的网络环境离哪个镜像源延迟低就用哪个(注意如果你的网络环境不好此命令将耗时较长)
nrm test

1.手动切换

不想安装nrm或者安装nrm时因为未切源很慢,可以手动指定镜像源比如:

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

npm config set registry+镜像地址即可

npm 官方原始镜像网址是:https://registry.npmjs.org/
淘宝 NPM 镜像(变更):https://registry.npmmirror.com
腾讯云 NPM 镜像:https://mirrors.cloud.tencent.com/npm/
华为云 NPM 镜像:https://mirrors.huaweicloud.com/repository/npm/

个人使用的是淘宝的,也就是阿里。

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容