问题描述

在使用NPM安装包的过程中,出现以下错误:

npm ERR! code CERT_HAS_EXPIRED

npm ERR! errno CERT_HAS_EXPIRED

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

原因分析

请求到的 https://registry.npm.taobao.org/cnpm 失败,原因是证书已经过期。

2024年1月22日,淘宝NPM镜像站的域名 registry.npm.taobao.org 的SSL证书过期。

解决方案

清理NPM的缓存

npm cache clean --force

切换到新的NPM镜像站

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

检查是否成功切换到新的镜像站

npm config get registry

如果这个命令返回的是 https://registry.npmmirror.com,那么就说明已经成功切换到了新的镜像站。

参考资料

https://developer.aliyun.com/article/801527 https://juejin.cn/post/7327472360863924224

精彩内容

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: