Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 13 of 28 · javascript

Auto‑Updates with electron‑updater

Duration: 13 mins

Auto‑Updates with electron‑updater

electron‑updater (part of electron‑builder) abstracts away the platform‑specific update mechanisms (Squirrel on Windows, NSIS, macOS app‑store, etc.).

Install

npm install electron-updater

Basic usage in main.js

const { autoUpdater } = require('electron-updater');

autoUpdater.checkForUpdatesAndNotify();

autoUpdater.on('update-available', info => {
  console.log('Update available', info.version);
});
autoUpdater.on('update-downloaded', info => {
  const choice = dialog.showMessageBoxSync({
    type: 'question',
    buttons: ['Later', 'Install now'],
    defaultId: 1,
    message: `Version ${info.version} downloaded. Install now?`
  });
  if (choice === 1) autoUpdater.quitAndInstall();
});

Packaging for updates

  • Use electron‑builder to create a GitHub release (or any server) that hosts the *.exe, *.dmg, *.AppImage files.
  • Set the publish field in package.json:
"build": {
  "publish": [{ "provider": "github", "owner": "myuser", "repo": "my‑app" }]
}

Now each new release is automatically detected by autoUpdater.

Previous: Installing Node, npm & ElectronNext: Packaging & Distribution – electron‑builder