问题描述
在使用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://www.toymoban.com/news/detail-829327.html
参考资料
https://developer.aliyun.com/article/801527
https://juejin.cn/post/7327472360863924224文章来源地址https://www.toymoban.com/news/detail-829327.html
到了这里,关于【Node.js】npm ERR! request to https://registry.npm.taobao.org/cnpm failed ... certificate has expired的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!