electron-builder-squirrel-windows is a plugin for electron-builder that facilitates the creation of Squirrel.Windows installers for Electron applications. This enables developers to package their Electron apps into a format suitable for automatic updates and user-friendly installation on Windows systems. The current stable version is 26.8.1, aligning with the electron-builder major version. electron-builder and its ecosystem, including this plugin, maintain an active release cadence, often issuing patch and minor updates in response to bug fixes or Electron framework advancements. Its primary differentiator is its seamless integration within the comprehensive electron-builder toolchain, offering a streamlined approach to multi-platform application packaging, particularly for Windows auto-updates and silent installations, compared to direct Squirrel.Windows usage.
npm install electron-builder-squirrel-windowsVerified import paths — ran on the pinned version, not inferred.
This `package.json` snippet demonstrates how to configure `electron-builder` to generate a Squirrel.Windows installer. It includes defining the `appId`, `productName`, output directory, and specific Squirrel.Windows options like `certificateFile` and `certificatePassword` for code signing. The `build:win` script invokes `electron-builder` to create the Windows executable.
For new projects, evaluate using the `nsis` target in your `electron-builder` configuration. If migrating, review NSIS documentation for equivalent options.
Regularly update `electron-builder` and its plugins to their latest patch versions to incorporate security fixes. Run `npm update electron-builder electron-builder-squirrel-windows`.
On macOS, install mono via Homebrew: `brew install mono`. On Linux, ensure `mono` and `wine` are installed and configured.
Include `if (require('electron-squirrel-startup')) return;` at the very beginning of your main Electron process file (e.g., `main.js`) to handle these events gracefully.Obtain a code signing certificate (`.pfx` file), and configure `squirrelWindows.certificateFile` and `squirrelWindows.certificatePassword` in your `electron-builder` configuration. Consider using environment variables for the password in CI/CD.
Ensure your `package.json` contains a non-empty `description` field, e.g., `"description": "My awesome Electron application."`
Ensure `node_modules` is correctly installed by deleting `node_modules` and `package-lock.json`/`yarn.lock`, then reinstalling dependencies. If using Yarn PnP, configure `nodeLinker: "node-modules"` in `.yarnrc.yaml`.
Verify `mono` is installed and accessible in your PATH. If running on Linux, also ensure `wine` is installed. Check `~/.cache/electron-builder/Squirrel.Windows/` for the integrity of downloaded Squirrel.Windows tools and binaries. Clearing the cache might help (`rm -rf ~/.cache/electron-builder`).
Ensure the path to `build/icon.ico` is correct and the file exists. It must be a Windows ICO file. If you were previously using `iconUrl` directly in `build` and upgraded, ensure it's now under `squirrelWindows.iconUrl` or `win.icon` with a local path.