安装/运行由Electron-package生成的应用程序(Installing/Running an app generated from Electron-package)

我已经使用电子包生成了一个应用程序。 当运行生成在客户端的Windows PC中的exe未运行。 客户端PC中是否安装了任何先决条件? 我还没有安装Node。

I have generated an app using electron-package. when running the exe generated in client's windows PC its not running. Is there any prerequisites to be installed in client PC? I haven't installed Node.

最满意答案

尝试从命令行运行您的.exe。 也许你会弄清楚是什么导致你的应用程序崩溃。 我遇到了同样的问题,双击.exe将不会执行任何操作。 当我从命令行运行.exe(例如out\myApp-win32-x64\myApp.exe )时,我能够看到我的应用程序的console.log()和console.err() ,并且我意识到我的问题是。

在我的情况下,我的应用程序使用的是相对于process.cwd()路径,当从.exe直接运行应用程序时,这些路径被搞砸了。 这导致应用程序甚至在显示窗口之前崩溃,因此为什么没有运行。

Try running your .exe from the command line. Maybe you'll be able to figure out what's causing your app to crash. I had the same problem, double-clicking the .exe would do nothing. When I ran the .exe from the command line (i.e. out\myApp-win32-x64\myApp.exe), I was able to see my app's console.log() and console.err(), and I realized what my problem was.

In my case, my app was using paths relative to process.cwd(), which were messed up when running the app directly from the .exe. That caused the app to crash even before showing the window, hence why nothing seemed to be running.

更多推荐