咨询一个前端 Vue3 中集成 Electron 问题

333 天前
 chenxishen
我本地的 Node 版本,16.2.0
首先执行,cnpm i @vue/cli -g
cnpm i electrion -g
然后 vue create electron-demo, 选择的是 vue3
创建完之后,进入 electron-demo 文件夹,再执行 vue add electron-builder ,这里选择的是 Electron 13.0.0 版本,然后就报错了, 上面命令都是管理员执行的,我试了好几个版本的 node 都不行,然后各种搜报错原因,都没找到解决办法,不知道啥情况,求大神指点

npm ERR! code 1
npm ERR! path C:\Users\Administrator\Desktop\Demo\vue-electron\electron-demo\node_modules\electron
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! RequestError: certificate has expired
npm ERR! at ClientRequest.<anonymous> (C:\Users\Administrator\Desktop\Demo\vue-electron\electron-demo\node_modules\got\source\request-as-event-emitter.js:178:14)
npm ERR! at Object.onceWrapper (node:events:472:26)
npm ERR! at ClientRequest.emit (node:events:377:35)
npm ERR! at ClientRequest.origin.emit (C:\Users\Administrator\Desktop\Demo\vue-electron\electron-demo\node_modules\@szmarczak\http-timer\source\index.js:37:11)
npm ERR! at TLSSocket.socketErrorListener (node:_http_client:447:9)
npm ERR! at TLSSocket.emit (node:events:365:28)
npm ERR! at emitErrorNT (node:internal/streams/destroy:193:8)
npm ERR! at emitErrorCloseNT (node:internal/streams/destroy:158:3)
npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21)

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache\_logs\2024-01-31T08_23_49_643Z-debug.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess.<anonymous> (D:\nvm\nvm\v16.2.0\node_modules\@vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:365:28)
at ChildProcess.cp.emit (D:\nvm\nvm\v16.2.0\node_modules\@vue\cli\node_modules\.store\cross-spawn@6.0.5\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
865 次点击
所在节点    问与答
2 条回复
hellodigua
333 天前
chenxishen
333 天前
@hellodigua 感谢大佬,一下就解决了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1013160

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX