question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A JavaScript error occurred in the main process

See original GitHub issue

Preflight 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
dev-nicolaoscommented, May 18, 2019

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.

0reactions
maleptcommented, Apr 13, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Javascript Error Occurred in the Main Process [Discord]
Corrupt program files – If your program or its settings have gone corrupt, this error and others may be triggered. Deactivated services –...
Read more >
How to Fix the 'A JavaScript Error Occurred in the Main ...
Solution 2: Change the Startup Type of the Quality Windows Audio Video Experience Service ... Changing the startup type of the Quality Windows ......
Read more >
A JavaScript error occurred in the main process message on ...
A JavaScript error occurred in the main process · 1) Delete the app data folders in %AppData% and %LocalAppData%. · 2) Re-register the...
Read more >
Fix 'A JavaScript Error Occurred in the Main Process' Error in ...
Solutions to fix the “A Javascript Error Occurred in the Main Process” Error in Discord: 1. Delete Discord Folders in AppData and LocalAppData...
Read more >
How to fix “a JavaScript error occurred in the main process ...
How to fix “a JavaScript error occurred in the main process” error in Discord · Reinstall your program · Remove all the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found