Auto Update

develar edited this page Jan 21, 2017 · 9 revisions

See the Publishing Artifacts section of the Wiki for more information on how to configure your CI environment for automated deployments.

Real project example.

Simplified auto-update is not supported for Squirrel.Windows.

Quick Setup Guide

  1. Install electron-updater as an app dependency.

  2. Configure publish.

  3. Use autoUpdater from electron-updater instead of electron, e.g. (ES 6):

    import {autoUpdater} from "electron-updater"
  4. Do not call setFeedURL. electron-builder automatically creates app-update.yml file for you on build in the resources (this file is internal, you don't need to be aware of it).

    But if need, you can — for example, to explicitly configure Bintray provider:

      provider: "bintray",
      owner: "actperepo",
      package: "no-versions"

Currently, generic (any HTTPS web server), github and bintray are supported. latest.yml (or latest-mac.json for macOS) will be generated in addition to installer for generic and github and must be uploaded also (in short: only bintray doesn't use latest.yml and this file must be not uploaded on Bintray).

NOTICE: Bintray provider doesn't support macOS auto-update currently. If need, please file issue.


You don't need to listen all events to understand what's wrong. Just set logger. electron-log is recommended (it is an additional dependency that you can install if needed).

autoUpdater.logger = require("electron-log")
autoUpdater.logger.transports.file.level = "info"


Name Default Description
autoDownload true Automatically download an update when it is found.
logger console The logger. You can pass electron-log, winston or another logger with the following interface: { info(), warn(), error() }. Set it to null if you would like to disable a logging feature.


The autoUpdater object emits the following events:

Event: error


  • error Error

Emitted when there is an error while updating.

Event: checking-for-update

Emitted when checking if an update has started.

Event: update-available

Emitted when there is an available update. The update is downloaded automatically if autoDownload is not set to false.

Event: update-not-available

Emitted when there is no available update.

Event: download-progress


  • bytesPerSecond
  • percent
  • total
  • transferred

Emitted on progress.

Event: update-downloaded


  • event Event

Emitted when an update has been downloaded.


The autoUpdater object has the following methods:


  • options GenericServerOptions | BintrayOptions | GithubOptions | string — if you want to override configuration in the app-update.yml.

Sets the options. If value is string, GenericServerOptions will be set with value as url.

autoUpdater.checkForUpdates(): Promise<UpdateCheckResult>

Asks the server whether there is an update.


Restarts the app and installs the update after it has been downloaded. It should only be called after update-downloaded has been emitted.

Note: autoUpdater.quitAndInstall() will close all application windows first and only emit before-quit event on app after that. This is different from the normal quit event sequence.