简体   繁体   中英

Electron --serve fails on missing package.json

I have a strange issue working on PoC application. It is an Electron app using Angular 7 and Ionic 4. It's very simple, just two routes, one fake service and not much going on there.

In package.json I have defined following scripts:

"electron:serve": "electron . --serve",
"electron:transpile": "webpack ./electron/src/main.ts --config ./electron/webpack.electron.config.js",
"build:electron": "npm run electron:transpile && npm run build:web && electron-builder build"

Folder structure is as follows:

poc-client
+- dist
   +- ...
+- electron
   +- dist
   +- src
   +- tsconfig.json
   +- webpack.electron.config.js
+- src
   +- ...
+- package.json

Now wen I run build:electron it builds the app, generates executable in dist folder and everything works as expected. But when I run electron:serve Electron starts but I'll get the following error:

错误

Console in VS Code shows no error when running the script neither there are any issues shown in Chromium Dev Tools. I found this , but it's not the case, I tried adding fake package.json to electron folder but with no effect. I'm running out of ideas, what to do.

看起来您在dist目录中提供服务,但在根目录中寻找package.json文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM