解决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 成功了。

相关推荐
RichardMiao几秒前
axios 的 withCredentials 到底做了什么?
前端·javascript·http
donecoding1 分钟前
CSS scroll-behavior 与 JS scrollTo 的协同与博弈
前端
匠心网络科技3 分钟前
JavaScript进阶-深入解析ES6的Set与Map
前端·javascript·学习·ecmascript·es6
Moment5 分钟前
到底选 Nuxt 还是 Next.js?SEO 真的有那么大差距吗 🫠🫠🫠
前端·javascript·后端
神州数码云基地6 分钟前
首次开发陌生技术?用 AI 赋能前端提速开发!
前端·人工智能·开源·ai开发
程序员小易24 分钟前
前端轮子(2)--diy响应数据
前端·javascript·浏览器
前天的五花肉24 分钟前
D3.js研发Biplot(代谢)图
前端·javascript·css
oh,huoyuyan30 分钟前
【实用技巧】火语言RPA:界面『日期时间』控件,实现网页日期自动填写
前端·javascript·rpa
程序员小寒30 分钟前
前端性能优化之Webpack篇
前端·webpack·性能优化
谢尔登31 分钟前
React的Fiber架构
前端·react.js·架构