首页 前端知识 npm install|certificate has expired 证书过期

npm install|certificate has expired 证书过期

2024-09-21 21:09:24 前端知识 前端哥 998 122 我要收藏

使用 npm install 命令安装 Node.js 项目的依赖时,遇到 “certificate has expired” 错误,可能是连接到的某个服务器上的 SSL/TLS 证书已经过期。也可能是正在使用的 npm 仓库(通常是 npm 官方仓库)或者中间代理服务器的证书没有得到及时更新

sh-3.2# npm install
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/yauzl/download/yauzl-2.10.0.tgz failed, reason: certificate has expired

npm ERR! A complete log of this run can be found in: /var/root/.npm/_logs/2024-04-25T02_04_01_904Z-debug-0.log

遇到 npm ERR! code CERT_HAS_EXPIRED 错误时,尝试从淘宝的npm镜像(registry.npm.taobao.org)下载包时,由于SSL/TLS证书问题而失败了

我这里简单粗暴,禁用 strict-ssl ,允许继续使用该镜像

npm config set strict-ssl false

将 npm 的 strict-ssl 设置为 false 会使 npm 在与仓库通信时忽略 SSL 证书错误,绕过 npm 在安装过程中对 SSL 证书的检查

附上镜像源
npm config set registry https://registry.npmjs.org/
npm config set registry https://registry.npmmirror.com

转载请注明出处或者链接地址:https://www.qianduange.cn//article/18483.html
标签
评论
发布的文章

javascript jQuery

2024-09-21 22:09:33

【若依】表格固定列宽

2024-09-21 22:09:30

Knockout-jQueryUI 使用指南

2024-09-21 22:09:29

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!