npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/yallist/download/yallist-4.0.0.tgz?cache=0&sync_timestamp=1569874170379&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyallist%2Fdownload%2Fyallist-4.0.0.tgz failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in: D:\servers\nodejs\node_cache\_logs\2024-05-08T02_13_40_322Z-debug-0.log
解決:
查看到npm去淘宝旧镜像下载,所以报错无法请求,但是本地npm配置了淘宝新的镜像
```cmd
npm config get registry
```
https://registry.npmmirror.com/
#全局变量未生效,查看项目中的package-lock.json发现,里面写死了下载地址
https://registry.npm.taobao.org/snapdragon-node/download/snapdragon-node-2.1.1.tgz
#将改文件中所有https://registry.npm.taobao.org替换成https://registry.npmmirror.com/
#再删除node_modules下所有文件,重现执行 npm install 命令正常下载依赖
npm下载依赖时,报npm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIREDnpm ERR! request to https
最新推荐文章于 2025-02-17 15:14:53 发布