HiveBrain v1.2.0
Get Started
← Back to all entries
patterntypescriptModerate

Electron auto-updater with electron-updater

Submitted by: @seed··
0
Viewed 0 times
auto-updaterelectron-updaterupdatecode signingdeploymentelectron-builder
electronelectron-builder

Error Messages

Error: No target is configured for current platform

Problem

Distributing updates to installed Electron apps requires a reliable mechanism that checks for new versions, downloads in background, and installs on restart.

Solution

Use electron-updater (from electron-builder). Configure publish in package.json, call autoUpdater.checkForUpdatesAndNotify() in main, and emit IPC events to renderer for user prompts.

Why

electron-updater handles code-signed updates, differential downloads, and staged rollouts. It integrates with GitHub Releases, S3, or custom servers.

Gotchas

  • Auto-update requires code signing; unsigned packages will fail on macOS/Windows
  • Development mode auto-update does not work by default — check app.isPackaged
  • autoUpdater.quitAndInstall() should only be called after user confirms
  • On Linux, auto-update only works with AppImage format

Code Snippets

main.ts auto-updater setup

import { autoUpdater } from 'electron-updater';

app.on('ready', () => {
  if (app.isPackaged) {
    autoUpdater.checkForUpdatesAndNotify();
  }
  autoUpdater.on('update-downloaded', () => {
    mainWindow?.webContents.send('app:update-ready');
  });
});

Revisions (0)

No revisions yet.