解决npm安装electron总失败的问题

复制代码
add electron --save-dev --registry=https:/registry.npm.taobao.org
npm ERR! code 1
npm ERR! path C:\Users\xxxxxxxxx\app\node_modules\electron
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node install.js
npm ERR! RequestError: unable to verify the first certificate
npm ERR!     at ClientRequest.<anonymous> (C:\Users\xxxxxxxxx\app\node_modules\got\dist\source\core\index.js:970:111)
npm ERR!     at Object.onceWrapper (node:events:628:26)
npm ERR!     at ClientRequest.emit (node:events:525:35)
npm ERR!     at origin.emit (C:\Users\xxxxxxxxx\app\node_modules\@szarczak\http-timer\dist\source\index.js:43:20)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:502:9)
npm ERR!     at TLSSocket.emit (node:events:513:28)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR!     at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
npm ERR!     at TLSSocket.emit (node:events:513:28)
npm ERR!     at TLSSocket._finishInit (node:_tls_wrap:959:8)
npm ERR!     at ssl.onhandshakedone (node:_tls_wrap:743:12)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxxxxxx\AppData\Local\npm-cache\_logs\2023-10-18T08_03_12_856Z-debug-0.log

百度和谷歌搜索,各种换源加代理都没解决。 最后找到了https://npmmirror.com/这个网站,根据指导,安装定制的cnpm管理工具npm install -g cnpm --registry=https://registry.npmmirror.com

然后执行cnpm install --save-dev electron 成功了。

相关推荐
胡萝卜术6 小时前
力扣5. 最长回文子串
前端·javascript·面试
我星期八休息6 小时前
网络编程—应用层HTTP协议
linux·运维·开发语言·前端·网络·网络协议·http
不好听6137 小时前
前端路由完全指南(下篇):懒加载、History 栈与工程化实践
前端·react.js
圣光SG9 小时前
Java Web入门基础知识笔记
java·前端·笔记
cyforkk10 小时前
Vercel 绑定自定义域名极简配置指南
服务器·前端·网络
IT_陈寒11 小时前
React useEffect依赖数组中埋的坑,这次终于让我逮到了
前端·人工智能·后端
FourAu12 小时前
2026 前端突围指南:从 ESR 边缘渲染到封装 Web AI SDK,聊聊 AI 时代的职业进化
前端·人工智能
Zkeq12 小时前
不止是聊天框:我用 EdgeOne Makers Agents 给烹饪 APP 加了一位能“改菜谱”的 AI 主厨
前端
咩咩啃树皮12 小时前
第32篇:前端本地存储全解——Cookie、localStorage、sessionStorage 区别与实战
前端