[英]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
我已经构建了一个 Electron 应用程序,它在使用以下命令从命令行运行时可以正常工作:
npm start
I want to deploy the application as user-friendly installers for Mac/Windows/Linux.我想将该应用程序部署为 Mac/Windows/Linux 的用户友好安装程序。 To achieve this I am using Electron-Builder for packing and building my source files.
为了实现这一点,我使用Electron-Builder来打包和构建我的源文件。 The command I use to execute the build process is:
npx electron-builder
.我用来执行构建过程的命令是:
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主进程发生Javascript错误
Uncaught Exception:未捕获的异常:
TypeError: Callback is not a function类型错误:回调不是函数
at ELECTRON_ASAR.js:600:9在 ELECTRON_ASAR.js:600:9
at _combinedTickCallback (internal/process/next_tick.js:131:7)在 _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)在 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
.如果在使用
npx electron-builder
后使用npm start
命令,我也会收到此消息。
I have tested on both Mac and Linux and I receive the same message.我已经在 Mac 和 Linux 上进行了测试,并且收到了相同的消息。 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.
因此,我认为这是 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您可以执行以下建议
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如果您想详细了解如何执行此过程,请访问 -->https://www.thewindowsclub.com/javascript-error-occurred-in-the-main-process
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.