Doesn't work on Windows
I copied your code to my app.
For whatever reason, electron on windows doesn't pick up new releases.
At https://github.com/intelligrate/query-cloud-api/releases, I've two releases.
Whilst running 1.0 release,
"build": { "publish": [ { "provider": "github", "owner": "intelligrate", "repo": "query-cloud-api" } ],
I expect, auto-updater to prompt and pick up 2.0.
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L268
That doesn't happen.
@girishbr Have you tried forking the repo and testing before adding your own code? From what I can see, you have all the update listeners calling sendStatusToWindow but don't have that function defined anywhere.
Instead of using this block of code: https://github.com/iffy/electron-updater-example/blob/master/main.js#L46 (which is not required for updates to work)
Choose one of the two options listed here: https://github.com/iffy/electron-updater-example/blob/master/main.js#L103
@iffy thank you for the feedback. I forked it here: https://github.com/girishbr/electron-updater-example/. Now, I understand how your code works.
I moved it all to about.html https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L18
ipcRenderer.on('message', function(event, text) {
var container = document.getElementById('messages');
var message = document.createElement('div');
message.innerHTML = text;
container.appendChild(message);
})
So, when about.html finishes loading
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L169, I call autoUpdater.checkForUpdatesAndNotify
And on various events like 'checking-for-update', 'update-available', etc, the message is sent to about.html via https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L174
function sendStatusToWindow(text) {
log.info(text);
aboutWin.webContents.send('message', text);
}
This closely mimics what I forked. But, it won't work still.
Aah! I've to choose one of the two options. My bad. Will check it again.
@girishbr k, let me know if it works
Took the easy route with just autoUpdater.checkForUpdatesAndNotify(); right here.
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L309.
- Published version 2. Downloaded it
- Changed version 2 to version 3. Published it again and made it public.
- Ran version 2 from my PC again and closed it expecting it to update.
- Ran version 2 again to see the version in about https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L15 - still version 2.
Your code is solid. But, I believe I'm making a fundamental mistake somewhere.
I only see v0.0.3, v0.0.1, v0.0.2 in your list of releases: https://github.com/intelligrate/query-cloud-api/releases And v0.0.2 was released 3 days ago?
Maybe your v2 that you're running is not a version with the new code?
that's weird! This's what I see.

Maybe make 0.0.4 and 0.0.5 (both publicly released -- not drafts) to avoid potential name conflicts?
Did that. Deleted all the releases.
Just have only one line for checkForUpdatesAndNotify()
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L310
Created version 0.0.1, pushed, published, installed. Changed package.json to 0.0.2, pushed, published.
Opened app(v0.0.1) expecting an updation to 0.0.2. Didn't happen.
@girishbr I'm not sure how the UI works on Windows, but when using checkForUpdatesAndNotify on my mac, I have to launch the app, then wait for it to download the new version (the update notification doesn't appear immediately), then I get a notification, then I have to quit the application and restart it to see the new version. But I'm assuming you're waiting for a bit after starting the app.
Hmm... I'm not sure what the problem is from looking at your code and GitHub releases.
@iffy Thank you for your feedback. I finally got it to work. Seems like I cannot club autoUpdater call with the main window call. Please look at the comments.
app.on('ready', () => {
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 1200,
minHeight: 800,
icon: appIcon
});
mainWindow.loadURL('file://' + __dirname + '/webapp/index.html');
if (process.env.ACTIVATE_DEBUG) {
mainWindow.webContents.openDevTools({
mode: 'detach'
});
}
// autoUpdater.checkForUpdatesAndNotify();
// If auto Updater is called here, updation won't work.
// It has to be called explicitly in a separate event handler
// like it's done below.
})
//has to be here only - although both events are "ready"
app.on('ready', function() {
autoUpdater.checkForUpdatesAndNotify();
});
something to do with ES6 syntax?
I doubt it's some ES6 syntax thing. That seems really odd that it would work in its own handler but not in one with other stuff in it. How long do you have to wait for the notification to appear in the working version?
It doesn't happen automatically. It happens only when I exit. And that too only with an explicit exit (ctrl + q) not a window close. I am planning on bundling it up into a menu option "Update and Restart".
@girishbr is this resolved? Can I close this issue?
I just forked the repo and tried it. I only changed owner. No codesigning for windows (neither for mac). The windows app detects that their is an update available "Update available", but soon after it just says "Update downloaded". Their is no progress bar in between. Restarting the app doesn't change anything.
The auto-updater currently doesn't work. There's is a temporary solution until the PR is accepted. Worked for me.
Update: it works as expected.
Update 2: Use the Auto updates - Option 2 - More control from https://github.com/iffy/electron-updater-example/blob/fb1b690f9719ec3a0fe4c0f6fe31e79e5c203dec/main.js#L127-L142
Sorry for the noise :(
I have forked the repo, adjusted the owner, and added nsis as a win target. Published a new release, then another release. The updates are picked up and downloaded on Windows, but there is no automatic restart. Is this the expected behavior? A manual restart resolves the problem:

Thank you!
Update:
Here is the log from c:\Users\kittaakos\AppData\Roaming\electron-updater-example\log.log:
[2019-07-09 13:06:07:0559] [info] App starting...
[2019-07-09 13:06:08:0115] [info] Checking for update
[2019-07-09 13:06:08:0247] [info] Checking for update...
[2019-07-09 13:06:08:0531] [info] Generated new staging user ID: 294d42f1-7072-53d5-8730-4ebd99f8ce76
[2019-07-09 13:06:12:0092] [info] Update for version 0.7.3 is not available (latest version: 0.7.3, downgrade is disallowed).
[2019-07-09 13:06:12:0092] [info] Update not available.
[2019-07-09 13:15:45:0301] [info] App starting...
[2019-07-09 13:15:45:0407] [info] Checking for update
[2019-07-09 13:15:45:0550] [info] Checking for update...
[2019-07-09 13:15:48:0699] [info] Found version 0.7.4 (url: electron-updater-example-setup-0.7.4.exe)
[2019-07-09 13:15:48:0700] [info] Update available.
[2019-07-09 13:15:48:0700] [info] Downloading update from electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:48:0741] [info] No cached update info available
[2019-07-09 13:15:48:0747] [info] Download block maps (old: "https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.3/electron-updater-example-setup-0.7.3.exe.blockmap", new: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe.blockmap)
[2019-07-09 13:15:49:0514] [info] File has 34 changed blocks
[2019-07-09 13:15:49:0520] [info] Full: 37,397.72 KB, To download: 775.44 KB (2%)
[2019-07-09 13:15:49:0549] [info] Differential download: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:49:0794] [info] Redirect to https://github-production-release-asset-2e65be.s3.amazonaws.com/195969671/80946800-a24a-11e9-9cba-a648ddcc499e
[2019-07-09 13:15:52:0776] [info] New version 0.7.4 has been downloaded to C:\Users\kittaakos\AppData\Local\electron-updater-example-updater\pending\electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:52:0784] [info] Update downloaded
[2019-07-09 13:16:17:0500] [info] Auto install update on quit
[2019-07-09 13:16:17:0500] [info] Install: isSilent: true, isForceRunAfter: false
[2019-07-09 13:18:28:0700] [info] App starting...
[2019-07-09 13:18:28:0861] [info] Checking for update
[2019-07-09 13:18:28:0944] [info] Checking for update...
[2019-07-09 13:18:32:0002] [info] Update for version 0.7.4 is not available (latest version: 0.7.4, downgrade is disallowed).
[2019-07-09 13:18:32:0002] [info] Update not available.
[2019-07-09 13:33:48:0245] [info] App starting...
[2019-07-09 13:33:48:0352] [info] Checking for update
[2019-07-09 13:33:48:0474] [info] Checking for update...
[2019-07-09 13:33:52:0367] [info] Found version 0.7.5 (url: electron-updater-example-setup-0.7.5.exe)
[2019-07-09 13:33:52:0367] [info] Update available.
[2019-07-09 13:33:52:0367] [info] Downloading update from electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:33:52:0403] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: H76g/JD4ZO0drEe1TE4MxCdi45Bmu018GUNGvD7nXz6Veo+0xZ0pL5zvzgZvBFR4llDTAdBJweFDVO9q+HFWcQ==, expected: Udc/GzlinP1QRCS/4rJf3/5pTvz1IeEs63wIZdLZRYBTddzb/wTHHiSHh3E4uO3uiyj9FfCYrNxlfrW9FlTPWw==. Directory for cached update will be cleaned
[2019-07-09 13:33:52:0430] [info] Download block maps (old: "https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe.blockmap", new: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.5/electron-updater-example-setup-0.7.5.exe.blockmap)
[2019-07-09 13:33:54:0004] [info] File has 38 changed blocks
[2019-07-09 13:33:54:0009] [info] Full: 37,397.75 KB, To download: 816.74 KB (2%)
[2019-07-09 13:33:54:0019] [info] Differential download: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.5/electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:33:54:0324] [info] Redirect to https://github-production-release-asset-2e65be.s3.amazonaws.com/195969671/30b6a080-a24c-11e9-9861-71e0827baf5c
[2019-07-09 13:34:00:0161] [info] New version 0.7.5 has been downloaded to C:\Users\kittaakos\AppData\Local\electron-updater-example-updater\pending\electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:34:00:0167] [info] Update downloaded
[2019-07-09 13:42:00:0096] [info] Auto install update on quit
[2019-07-09 13:42:00:0102] [info] Install: isSilent: true, isForceRunAfter: false
[2019-07-09 13:42:10:0154] [info] App starting...
[2019-07-09 13:42:10:0327] [info] Checking for update
[2019-07-09 13:42:10:0486] [info] Checking for update...
[2019-07-09 13:42:17:0102] [info] Update for version 0.7.5 is not available (latest version: 0.7.5, downgrade is disallowed).
[2019-07-09 13:42:17:0102] [info] Update not available.
[2019-07-09 13:42:33:0264] [info] App starting...
[2019-07-09 13:42:33:0432] [info] Checking for update
[2019-07-09 13:42:33:0571] [info] Checking for update...
[2019-07-09 13:42:37:0266] [info] Update for version 0.7.5 is not available (latest version: 0.7.5, downgrade is disallowed).
[2019-07-09 13:42:37:0267] [info] Update not available.