Electron-forege 启动失败: Electron failed to install correctly, please delete node_modules/electron and try installing again
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
F:\github\electron\node_modules\electron\index.js:17
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (F:\github\electron\node_modules\electron\index.js:17:11)
at Object.<anonymous> (F:\github\electron\node_modules\electron\index.js:21:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (F:\github\electron\node_modules\electron\cli.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elec@0.1.0 start: `vue-cli-service build && electron .`
原因是没有在package.json
中添加 main
字段的入口,
main.js
的具体内容请参考此文
https://buddy.works/tutorials/building-a-desktop-app-with-electron-and-vue-js