如何将电子应用程序编译到.exe [英] How To Compile An Electron Application To A .exe

查看:170
本文介绍了如何将电子应用程序编译到.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在学习如何在 Electron 中创建应用程序,我需要帮助将一个简单的项目编译为一个Windows可执行文件。该程序是该Github存储库的副本: https://github.com/electron/electron-quick -开始。在回购自述文件中,它显示了如何运行程序:

I've been learning how to create applications in Electron and I need help compiling a simple project to a Windows executable. The program is a clone from this Github repo: https://github.com/electron/electron-quick-start. On the repo readme it shows how to run the program:

# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Run the app
npm start

这很好,但我不知道如何简单地编译它。我在Google各处都看过,您会认为,像部署应用程序一样简单的事情就是众所周知的信息。

This works fine, but I can't figure out how to simply compile it. I've looked all over google, you would think that something as simple as deploying an application would be well known information.

推荐答案

您需要使用 电子打包程序

You need to use Electron Packager.

安装,请使用:

# for use in npm scripts
npm install electron-packager --save-dev

# for use from cli
npm install electron-packager -g

并使用以下方法打包或部署: / p>

And package or deploy using:

electron-packager <sourcedir> <appname> --platform=win32 --arch=x86_64

如果要随Electron安装一起保留,请参见 应用程序分发

If you would like to keep it with the Electron Installation, see Application Distribution.

更新:

以上命令可能会引发错误

Above command might throw an error


不受支持的arch = x86_64(字符串);必须是匹配的字符串:ia32,x64,armv7l,arm64,mips64el

Unsupported arch=x86_64 (string); must be a string matching: ia32, x64, armv7l, arm64, mips64el

建议使用ia32,x64, armv7l,arm64,mips64el

Suggested to use one of the options from ia32, x64, armv7l, arm64, mips64el

electron-packager <sourcedir> <appname> --platform=win32 --arch=x64

这篇关于如何将电子应用程序编译到.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆