共计 691 个字符,预计需要花费 2 分钟才能阅读完成。
npm install 时报错 code CERT_HAS_EXPIRED
一、报错情况
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/vue-loader failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in:
npm ERR! D:Environmentnvmnode_cache_logs2024-01-22T04_34_51_215Z-debug.log
这就说:npm 的证书失效了,它不再支持自签名证书
二、解决方案
查看自己的下载源
npm config get registry
发现我们之前配置了下载镜像源为 https 开头的,
https://registry.npm.taobao.org/
执行命令清除 npm 缓存
npm cache clean --force
执行命令取消 ssl 验证
npm config set strict-ssl false
再次执行 npm install ***,还不行可以尝试设置你的 npm 镜像源为 http 开头的,不使用 https
npm config set registry http://registry.npm.taobao.org
最后就可以了
原文地址: npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED npm ERR! request to https://registry.
正文完