简体   繁体   中英

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

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.

我使用的是旧版本的 Electron...更新到最新的稳定版本(当前为 10.1.5)解决了这个问题。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM