npm下载速度问题



前言

本篇博客为npm下载速度问题的处理


提示:以下是本篇文章正文内容,下面案例可供参考

一、来源:

苦于官方网站经常连接超时,淘宝镜像https://registry.npm.taobao.org/下载速度太慢,所以想要换一个镜像,无意间在Element Plus官网上看到一个镜像,于是就更换为了图中的中国NPM镜像(不过这个也属于淘宝的镜像源
安装 | Element Plus (gitee.io)
在这里插入图片描述

打开控制台输入npm config set registry registry.npmmirror.com回车即可
代码如下:

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

查看源地址(输入该命令即可查看是否切换成功,若显示https://registry.npmmirror.com/即切换成功)

npm config get registry

恢复默认源地址:控制台中输入

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

二、以下为youngko原创博客的引用

1、cmd命令中输入“npm config get registry”,该命令可以查看源地址(不需要查看可忽略)

2、cmd命令中输入“npm config set registry https://registry.npm.taobao.org ”(设置新下载地址,这里使用的是淘宝镜像地址)

3、设置好后,在cmd命令中输入“npm config get registry”,确认是否更改成功。

4、恢复默认源地址:cmd命令中输入“npm config set registry https://registry.npmjs.org/”

npm的镜像地址有以下几个:

官方镜像:https://registry.npmjs.org/

淘宝镜像:https://registry.npm.taobao.org/

cnpm镜像:https://r.cnpmjs.org/

阿里云镜像:https://npm.aliyun.com/

中国科技大学镜像:https://mirrors.ustc.edu.cn/npm/

华为云镜像:https://mirrors.huaweicloud.com/repository/npm/

七牛云镜像:https://npm.qiniu.com/
————————————————
版权声明:本文为优快云博主「youngko」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/youngko/article/details/132881970

总结

更换镜像源使用来源中的第一行代码即可
即:

npm config set registry https://registry.npmmirror.com/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值