Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ravipudi/c12716015ea0607fa5ab90184bc82396 to your computer and use it in GitHub Desktop.
Save ravipudi/c12716015ea0607fa5ab90184bc82396 to your computer and use it in GitHub Desktop.
Electron - Creating a windows portable executable

How to create a portable windows application without an installer from an electron project:

  1. Clone the electron-quick-start repo:
git clone https://github.com/electron/electron-quick-start
  1. yarn
  2. Make your application - probably edit main.js to navigate to some URL
  3. yarn add electron-packager
  4. Edit package.json - update the 'name' and add a new script 'packager':
{
  "name": "my-app-name",
  ...
  "scripts": {
	"start": "electron .",
    "packager": "electron-packager ./ --platform=win32"
  }
}
  1. 'npm start' will bring up the application
  2. 'npm run packager' will package the app for windows. You will see a new directory 'my-app-name-win32-x64' in the top directory of the project, with a my-app-name.exe
@jrobbl
Copy link

jrobbl commented Feb 18, 2025

@pa-0
And what other alternative for portability you find better?

@Svetloslav
Copy link

@pa-0 And what other alternative for portability you find better?

Maybe making it based on portableapps project platform. This is by far the best portable platform on Windows. Everything related to the program will be kept into a single directory, no changes to registry. On the other hand Electron applications are the easiest to place into portableapps project, yet you won't find any help on the net. Sad.

@pa-0
Copy link

pa-0 commented Aug 20, 2025

@jrobbl, i agree with what @Svetloslav suggested. That is probably the best option unless electron maintainers decide to expose some API to make it possible (which I doubt will happen, at least anytime soon) or you maintain a personal fork of the repo and make the changes yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment