解决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 分钟前
vue3.0性能提升主要通过那几方面体现的?
前端·vue.js
小磊哥er18 分钟前
【前端工程化】前端开发中的这些设计规范你知道吗
前端
江城开朗的豌豆19 分钟前
路由守卫:你的Vue路由‘保安’,全局把关还是局部盯梢?
前端·javascript·vue.js
Jinxiansen021126 分钟前
Vue 3 响应式核心源码详解(基于 @vue/reactivity)
前端·javascript·vue.js
OEC小胖胖5 小时前
去中心化身份:2025年Web3身份验证系统开发实践
前端·web3·去中心化·区块链
Cacciatore->6 小时前
Electron 快速上手
javascript·arcgis·electron
vvilkim6 小时前
Electron 进程间通信(IPC)深度优化指南
前端·javascript·electron
ai小鬼头8 小时前
百度秒搭发布:无代码编程如何让普通人轻松打造AI应用?
前端·后端·github
漂流瓶jz8 小时前
清除浮动/避开margin折叠:前端CSS中BFC的特点与限制
前端·css·面试
前端 贾公子8 小时前
在移动端使用 Tailwind CSS (uniapp)
前端·uni-app