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

相关推荐
excel1 小时前
nuxt 3 升级 nuxt 4 报错之 hasInjectionContext
前端
何以解忧,唯有..1 小时前
LangChain 工具调用(Tool Calling)实战指南
java·前端·langchain
软件聚导航2 小时前
「聚小软 AI 助手」技术升级:从数据库检索到 RAG 知识库问答
前端·数据库·mysql·微信小程序·小程序·ai编程·rag
恋猫de小郭3 小时前
看懂大模型架构术语,帮助你理解目前常见的大模型开源架构
前端·人工智能·ai编程
yma163 小时前
通过提示词实现GitHub Pages 和 Nginx 双部署竟然这么简单?
前端
前端 贾公子3 小时前
第09章:上下文与记忆 (2)
java·服务器·前端
可乐鸡翅yeah_3 小时前
第三方接口对接 M3U8 流媒体排坑实战,解决外部服务商流兼容难题
前端·javascript·python·django·html·m3u8·m3u8在线
GoppViper3 小时前
RDF资源描述框架深度解析:语义Web的数据基石与实战逻辑
前端·数据库
郑州光合科技余经理3 小时前
本地生活服务系统:模块边界与结算字段怎么拆
java·开发语言·前端·后端·系统架构·uni-app·php
IT_陈寒3 小时前
Vue的嵌套组件竟然吃掉了我的事件?
前端·人工智能·后端