问题背景$ npm install electron -gnpm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIREDnpm ERR! request to https://registry.npm.taobao.org/electron failed, reason: certificate has expirednpm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2025-01-01T04_40_31_645Z-debug-0.log 今天安装electron失败造成的问题记录, 遇到这个提示这个错误表明您的npm客户端证书已经过期,这里因为我切换过镜像源,因此提示我是请求淘宝镜像源失败,reason: cer
tificate has expired 原因,证书过期。 解决方案因此优雅草央千澈执行 npm config set strict-ssl false 此命令来忽略证书验证,官方说可能会有错,但优雅草央千澈认为不太会有什么错,除非你下载electron被劫持,几率大吗?不大。 本文结束,完美解决,同类因为证书报错的问题,均可参考
|