Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Compile An Electron Application To A .exe [duplicate]

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 

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.

like image 967
Mitch Mitchell Avatar asked Nov 15 '16 17:11

Mitch Mitchell


People also ask

How do you make an Electron executable file?

Create the Electron based Syncfusion Application as mentioned in this link. Then package the application using Electron Packager, once packing completed JS_Electron-win32-ia32 folder will be created with Electron package file.

How do you run an EXE file system application using Electron framework?

To execute an application using Electron, we are going to use the child_process class of Node. js. From child_process we'll use execFile , this function is similar to child_process. exec() except it does not execute a subshell but rather the specified file directly.

Are Electron apps compiled?

The app command runs the Electron app for testing, and the build command will compile a final executable version of it for the current platform and save it into a build folder. All three commands can be run from the terminal in the following format: npm run <command> (e.g. npm run transpile ).


1 Answers

You need to use Electron Packager.

Install it using:

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

And package or deploy using:

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

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

Update :

Above command might throw an error

Unsupported arch=x86_64 (string); must be a string matching: 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 
like image 193
Praveen Kumar Purushothaman Avatar answered Sep 23 '22 06:09

Praveen Kumar Purushothaman