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" running app on OSX that was packaged on Linux

See original GitHub issue

When I package an app for OSX on Linux, on Launch I get the error in the subject (details below)

If I run electron on the source on the mac, it’s fine.

  • Which version of electron-packager are you using? 5.1.1
  • What cli arguments are you passing? electron-packager . UF --platform=darwin --arch=x64 --version=0.34.2 --overwrite
  • What platform are you running electron-packager on? Ubuntu 14.04.01 LTS (32-bit)
  • What platform(s) are you building for? OSX 10.10.5
  • Is there a stack trace in the error message you’re seeing? No error on run of electron-packager. Error when launching application on OSX:
    A JavaScript error occurred in the main process

    Uncaught Exception:
    Error: Cannot find module 'electron'
        at Function.Module._resolveFilename (module.js:336:15)
        at Function.Module._load (module.js:286:25)
        at Module.require (module.js:365:17)
        at require (module.js:384:17)
        at Object.<anonymous> (/Volumes/iOS_apps/electron/UF.trimmed/UF-trimmed-darwin-x64/UF-trimmed.app/Contents/Resources/app/src/main.js:151:14)
        at Module._compile (module.js:434:26)
        at Object.Module._extensions..js (module.js:452:10)
        at Module.load (module.js:355:32)
        at Function.Module._load (module.js:310:12)
        at Object.<anonymous> (/Volumes/iOS_apps/electron/UF.trimmed/UF-trimmed-darwin-x64/UF-trimmed.app/Contents/Resources/atom.asar/browser/lib/init.js:123:10)

How to reproduce using generated binary

On OSX:

  • Download and unzip UF.zip
  • In Finder, navigate to the UF-trimmed-darwin-x64 folder
  • Double-click on UF-trimmed.app
  • See above error dialog

How to reproduce from source

On Ubuntu 14.04 LTS

  • Download and unzip UF.src.zip
  • cd UF.trimmed.src
  • run electron-packager . UF.trimmed --platform=darwin --arch=x64 --version=0.34.2 --overwrite
  • In Finder, navigate to UF.trimmed.src/UF-trimmed-darwin-x64
  • Double-click on UF-trimmed.app
  • See above error dialog

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
maleptcommented, Jan 23, 2019

@reach2jeyan since this is a 2+ year old issue, you’re better off asking your question (with a small, clear, reproducible testcase) in one of the community forums.

0reactions
reach2jeyancommented, Jan 23, 2019

I am using the electron version 4.0.2 in the package.json and it would still throw me the same error on npm start . The same would work on windows which is why I am kinda hesitant to do any change to the code. What issue is this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slack "A Javascript error occurred in the main process" Mac [Fix]
It seems that the “A javascript error occurred in the main process” issue only occurs with the 4.10 App Store version of the...
Read more >
Electron Builder: "Error occurred in the main process
The command I use to execute the build process is: npx electron-builder . When I try to run my packaged and built application,...
Read more >
app | Electron
Control your application's event lifecycle. Process: Main. The following example shows how to quit the application when the last window is closed: const ......
Read more >
How to fix “JavaScript error occurred in the main process” error?
You can check if the program is supposed to run on the system that your device has. · Click the Apple logo. ·...
Read more >
Running Visual Studio Code on Linux
Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the system's package manager.
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