Dev Diary - 22. May 2025
header_image

Creating Windows installer for Electron app

At Hotovo, we love web technologies and use them even for building mobile or desktop apps. Technologies such as React Native for mobile or Electron for desktop apps are mature, and developers can greatly benefit from using the tools they already know and love.

What We Built

Recently, we’ve been developing a desktop app for visually impaired users and needed to create a Windows installer to prepare it for end-user testing. Everything went smoothly using the Electron Builder package. We defined the NSIS installer target and planned to publish the package to a prepared Amazon S3 bucket.

The Packaging Problem

The first issue we encountered was that the packaging script was taking a long time and failing to build some dependencies. These same dependencies must have been built during the npm install command, as it didn’t fail. What helped was disabling Electron Builder from rebuilding the dependencies during packaging by setting "npmRebuild": false in package.json.

Why Does It Work?

Electron Builder calls npm rebuild for all installed dependencies during the packaging process. However, its error handling is stricter than during installation, and one of the optional sub-dependencies failed to build. This particular optional dependency isn’t necessary, and the app works correctly without it. Therefore, by skipping the rebuild, the already installed dependencies are used, and everything functions as expected.

READ MORE