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

场景复现 

 今天在进行联调的时候,本地起一下前端的代码,结果就报了以下错误

Could not fetch metadata for [email protected] FetchError: request to https://registry.npm.taobao.org/core-js failed, reason: certificate has expired
FetchError: request to https://registry.npm.taobao.org/core-js failed, reason: certificate has expired

看报错信息不难看出是因为证书已过期

解决 FetchError: request to https://registry.npm.taobao.org failed, reason: certificate has expired_第1张图片

原因分析 

我当时就在想我用的阿里淘宝的镜像,还能过期?没想到访问了一下还真是,离了个大谱!!!

我用的镜像地址是:https://registry.npm.taobao.org/ 。可以看到有效期截止2024年1月22日

解决 FetchError: request to https://registry.npm.taobao.org failed, reason: certificate has expired_第2张图片

解决方法 

 解决方法也很简单,换一个镜像就可以了,我换的是阿里的另一个镜像站:npmmirror 镜像站

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

其他镜像源推荐

Tencent-NPM

华为

中科大

你可能感兴趣的:(前端,npm,bug)