2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								title: 'Updating Applications'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								description: "There are several ways to update an Electron application. The easiest and officially supported one is taking advantage of the built-in Squirrel framework and Electron's autoUpdater module."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								slug: updates
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								hide_title: false
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								There are several ways to provide automatic updates to your Electron application.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								The easiest and officially supported one is taking advantage of the built-in
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 12:24:48 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[Squirrel ](https://github.com/Squirrel ) framework and
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 13:26:33 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Electron's [autoUpdater ](../api/auto-updater.md ) module.
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								## Using update.electronjs.org
 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-16 01:22:49 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								The Electron team maintains [update.electronjs.org][], a free and open-source
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 21:12:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								webservice that Electron apps can use to self-update. The service is designed
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								for Electron apps that meet the following criteria:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								-  App runs on macOS or Windows
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								-  App has a public GitHub repository
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								-  Builds are published to [GitHub Releases][gh-releases]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								-  Builds are [code-signed ](./code-signing.md )
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-16 01:22:49 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								The easiest way to use this service is by installing [update-electron-app][],
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								a Node.js module preconfigured for use with update.electronjs.org.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Install the module using your Node.js package manager of choice:
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```sh npm2yarn
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								npm install update-electron-app
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Then, invoke the updater from your app's main process file:
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-05 15:26:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```js title="main.js" @ts -nocheck
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								require('update-electron-app')()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 21:12:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								By default, this module will check for updates at app startup, then every ten
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								minutes. When an update is found, it will automatically be downloaded in the background.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								When the download completes, a dialog is displayed allowing the user to restart the app.
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 21:12:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								If you need to customize your configuration, you can
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[pass options to update-electron-app][update-electron-app]
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 21:12:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								or
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[use the update service directly][update.electronjs.org].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								## Using other update services
 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								If you're developing a private Electron application, or if you're not
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 21:12:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								publishing releases to GitHub Releases, it may be necessary to run your own
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								update server.
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								### Step 1: Deploying an update server
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								Depending on your needs, you can choose from one of these:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								-  [Hazel][hazel] –   Update server for private or open-source apps which can be
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  deployed for free on [Vercel][vercel]. It pulls from [GitHub Releases][gh-releases]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  and leverages the power of GitHub's CDN.
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								-  [Nuts][nuts] –   Also uses [GitHub Releases][gh-releases], but caches app
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  updates on disk and supports private repositories.
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								-  [electron-release-server][electron-release-server] –   Provides a dashboard for
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  handling releases and does not require releases to originate on GitHub.
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
										 
									
								 
							
							
								-  [Nucleus][nucleus] –   A complete update server for Electron apps maintained by
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  Atlassian. Supports multiple applications and channels; uses a static file store
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  to minify server cost.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								Once you've deployed your update server, you can instrument your app code to receive and
							 
						 
					
						
							
								
									
										
										
										
											2022-12-05 10:18:57 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								apply the updates with Electron's [autoUpdater ](../api/auto-updater.md ) module.
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								### Step 2: Receiving updates in your app
 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								First, import the required modules in your main process code. The following code might
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								vary for different server software, but it works like described when using [Hazel][hazel].
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:23:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								:::warning Check your execution environment!
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Please ensure that the code below will only be executed in your packaged app, and not in development.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								You can use the [app.isPackaged ](../api/app.md#appispackaged-readonly ) API to check the environment.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								:::
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```javascript title='main.js'
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								const { app, autoUpdater, dialog } = require('electron')
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Next, construct the URL of the update server feed and tell
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 13:26:33 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[autoUpdater ](../api/auto-updater.md ) about it:
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```javascript title='main.js'
							 
						 
					
						
							
								
									
										
										
										
											2017-08-14 13:26:33 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								const server = 'https://your-deployment-url.com'
							 
						 
					
						
							
								
									
										
										
										
											2020-04-30 18:54:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								const url = `${server}/update/${process.platform}/${app.getVersion()}` 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 12:48:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-30 18:54:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								autoUpdater.setFeedURL({ url })
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 15:19:59 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								As the final step, check for updates. The example below will check every minute:
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```javascript title='main.js'
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 12:48:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								setInterval(() => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  autoUpdater.checkForUpdates()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								}, 60000)
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Once your application is [packaged ](./application-distribution.md ),
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 21:20:59 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								it will receive an update for each new [GitHub Release][gh-releases] that you
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 12:53:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								publish.
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								### Step 3: Notifying users when updates are available
 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 12:24:48 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Now that you've configured the basic update mechanism for your application, you
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 11:38:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								need to ensure that the user will get notified when there's an update. This
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								can be achieved using the [autoUpdater API events ](../api/auto-updater.md#events ):
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 01:04:25 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-05 15:26:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```javascript title="main.js" @ts -expect-error=[11]
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 11:38:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 12:53:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  const dialogOpts = {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								    type: 'info',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								    buttons: ['Restart', 'Later'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								    title: 'Application Update',
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 22:55:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								    message: process.platform === 'win32' ? releaseNotes : releaseName,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								    detail:
							 
						 
					
						
							
								
									
										
										
										
											2023-05-15 00:58:35 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								      'A new version has been downloaded. Restart the application to apply the updates.'
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 12:53:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 13:09:06 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-18 09:49:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  dialog.showMessageBox(dialogOpts).then((returnValue) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								    if (returnValue.response === 0) autoUpdater.quitAndInstall()
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 12:53:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  })
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 11:38:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								})
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 12:24:48 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								Also make sure that errors are
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 11:38:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[being handled ](../api/auto-updater.md#event-error ). Here's an example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								for logging them to `stderr` :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```javascript title="main.js"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								autoUpdater.on('error', (message) => {
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 21:38:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								  console.error('There was a problem updating the application')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								  console.error(message)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								})
							 
						 
					
						
							
								
									
										
										
										
											2017-08-15 22:55:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2017-08-22 16:51:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								:::info Handling updates manually
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								Because the requests made by autoUpdate aren't under your direct control, you may find situations
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								that are difficult to handle (such as if the update server is behind authentication). The `url` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								field supports the `file://`  protocol, which means that with some effort, you can sidestep the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								server-communication aspect of the process by loading your update from a local directory.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								[Here's an example of how this could work ](https://github.com/electron/electron/issues/5020#issuecomment-477636990 ).
							 
						 
					
						
							
								
									
										
										
										
											2020-04-27 03:03:18 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 04:17:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								:::
							 
						 
					
						
							
								
									
										
										
										
											2020-04-27 03:03:18 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-18 16:42:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[vercel]: https://vercel.com
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								[hazel]: https://github.com/vercel/hazel
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[nuts]: https://github.com/GitbookIO/nuts
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 21:20:59 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[gh-releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating -a-release
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 17:24:15 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[electron-release-server]: https://github.com/ArekSredzki/electron-release-server
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
									
								 
							
							
								[nucleus]: https://github.com/atlassian/nucleus
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 10:49:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[update.electronjs.org]: https://github.com/electron/update.electronjs.org
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 12:15:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
									
								 
							
							
								[update-electron-app]: https://github.com/electron/update-electron-app