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.

javaScript error occurred in the main process

See original GitHub issue

Version 21.2.0

  • Target: Windows x64

My Electron app runs fine using electron from the command line, but after I’ve built it from an executable and try to run it I get:

[Window Title]
Error

[Main Instruction]
A JavaScript error occurred in the main process

[Content]
Uncaught Exception:
Error: The specified module could not be found.
\\?\C:\Users\username\AppData\Local\Temp\808c0bf6-a0f1-4211-a312-7c0cce29173a.tmp.node
    at process.func (electron/js2c/asar.js:140:31)
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:922:18)
    at Object.func (electron/js2c/asar.js:140:31)
    at Object.func [as .node] (electron/js2c/asar.js:149:18)
    at Module.load (internal/modules/cjs/loader.js:735:32)
    at Module._load (internal/modules/cjs/loader.js:648:12)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:775:19)

[OK]

I don’t know how to reproduce the error yet. Does anyone know why the app is attempting to load a module from AppData\Local? What module is this? How do I debug this problem?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17

github_iconTop GitHub Comments

4reactions
aabuhijlehcommented, Mar 12, 2020

Your app is trying to run a .node file from the %temp% directory. The reason behind this issue is that Windows cannot run node|dll|exeutable files from the asar package => so it copies them to %temp% and tries to execute them there.

To fix this, add this to your electron-builder configuration

"asarUnpack": ["**/*.node"]
3reactions
ajmetalcommented, Jun 9, 2020

I eventually discovered this issue is caused by a custom native node module I had created. If a native module fails to load for a myriad of reasons it will present with: Error: The specified module could not be found.

In my case there was a missing dependency the native node module required.

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 · Corrupt program or settings · The Quality Windows...
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