A JavaScript error occurred in the main process
See original GitHub issuePreflight Checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Issue Details
- Electron Packager Version:
- ^13.1.1
- Electron Version:
- ^5.0.1
- Operating System:
- macOS10.14.4
- Last Known Working Electron Packager version::
- ^13.1.1
Expected Behavior
electron-packager ./build cra --platform=mas --arch=x64 --out ~/ --overwrite
run cra.app
Actual Behavior
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
To Reproduce
Additional Information
electron .
is ok.but running error after the completion of the build
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
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 runningelectron src
and the app was running just fine. I installed electron packager and ranelectron-packager src
which 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.@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.