request to https://registry.npm.taobao.org/xxx failed, reason: certificate has expired

本文讲述了淘宝npm原镜像域名的HTTPS证书到期导致的报错,提供了解决方案,包括清空npm缓存、切换新源、安装cnpm等,并推荐了腾讯、华为和中科大的npm镜像作为替代选项。
摘要由CSDN通过智能技术生成

报错重现

淘宝原镜像域名(registry.npm.taobao.org)的 HTTPS 证书正式到期。如果想要继续使用,需要将 npm 源切换到新的源(registry.npmmirror.com),否则就会出现如下报错。

npm ERR! request to https://registry.npm.taobao.org/xxx failed, reason: certificate has expired

在这里插入图片描述

解决方法

许久没有更新过版本的人,看见错误一脸懵,年前还是好好的,现在连更新依赖版本都出现报错了!其实是一个小问题。按照如下步骤进行解决:

// 1. 清空缓存
npm cache clean --force
// 2. 切换新源
npm config set registry https://registry.npmmirror.com
// 3. 查看源是否设置成功
npm config get registry
// 4. 安装或者更新

不过淘宝还是推荐它的安装方式

// 1、安装cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com
// 2、检测是否安装成功
cnpm -v
// 3、安装你的依赖
cnpm install xxxxx

其他镜像

腾讯镜像
http://mirrors.cloud.tencent.com/npm/
华为镜像
https://mirrors.huaweicloud.com/repository/npm/
中科大镜像
https://registry.npmjs.org/
  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值