Electron Builder: "Error occurred in the main process - Callback is not a function"

Viewed 675

I have built an Electron application which works properly when running from command-line using: npm start

I want to deploy the application as user-friendly installers for Mac/Windows/Linux. To achieve this I am using Electron-Builder for packing and building my source files. The command I use to execute the build process is: npx electron-builder.



When I try to run my packaged and built application, I immediately receive an error message stating:

A Javascript error occurred in the main process
Uncaught Exception:
TypeError: Callback is not a function
at ELECTRON_ASAR.js:600:9
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)

screenshot of error message

After clicking OK on the pop-up, the application runs as expected. 



I also receive this message if I use the npm start command after building with npx electron-builder.

I have tested on both Mac and Linux and I receive the same message. I have even tested with an empty electron project (no custom code or dependencies) and I still receive this message. Therefore I assume that it is a problem with Electron-Builder.



Any ideas as to how I can stop this error message from popping up at the start of runtime?
Thanks.

2 Answers

I was using an older version of Electron... Updating to the most recent stable release (currently 10.1.5) fixed the problem.

you can carry out the following suggestions

  1. Delete the app data folders in %AppData% and %LocalAppData%
  2. Re-register the javascript dll file
  3. Reinstall skype, discord, etc, app that is having problems.

if you want a detailed breakdown on the to carry out this processes, kindly go to -->https://www.thewindowsclub.com/javascript-error-occurred-in-the-main-process

Related