electron-packager ./build cra --platform=mas --arch=x64 --out ~/ --overwrite
run cra.app
electron-packager ./build cra --platform=mas --arch=x64 --out ~/ --overwrite
run cra.app
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Unable to find a valid app
at Object.<anonymous> (/Users/Charlie/cra-mas-x64/cra.app/Contents/Resources/electron.asar/browser/init.js:120:9)
at Module._compile (internal/modules/cjs/loader.js:808:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:873:10)
at internal/main/run_main_module.js:21:11
electron . is ok.but running error after the completion of the build
馃憢 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
In order to debug your problem further, we need a minimal testcase to reproduce your problem. Using the electron-quick-start repository as a base, could you please create a minimal Electron app that illustrates the issue you described, and post a link to it here?
I ran into this same issue. Make sure your build script is pointing at the folder where your package.json is.
For example I'd moved all my source code into a src folder. I'd been testing the app by running electron src and the app was running just fine. I installed electron packager and ran electron-packager src which successfully packaged the app, but when I tried to run the executable I got the above error message. Then I realized my package.json's main field was already pointing at the src directory. I ran electron-packager . and it worked as expected.
Since the original issue reporter has not responded to the request for additional information in about a week, I'm going to assume that they either found the answer in another manner or decided not to pursue this issue. If I'm incorrect, they can respond with answers to the questions posed, and I'll reopen.
Still an issue.
@Zyles please follow the instructions in https://github.com/electron/electron-packager/issues/992#issuecomment-491847998 - otherwise, there's nothing for folks to use as a base to determine what the root cause is.
Most helpful comment
I ran into this same issue. Make sure your build script is pointing at the folder where your
package.jsonis.For example I'd moved all my source code into a
srcfolder. I'd been testing the app by runningelectron srcand the app was running just fine. I installed electron packager and ranelectron-packager srcwhich successfully packaged the app, but when I tried to run the executable I got the above error message. Then I realized mypackage.json's main field was already pointing at the src directory. I ranelectron-packager .and it worked as expected.