5

electron updater 4.2.0 package do not download new release but can detect it

This is a private repository on github

new releases successfully send to github

release github

In package.json:

"build": {
"appId": "com.myApp.ID",
"npmRebuild": false,
"win": {
  "icon": "./resources/electron/icons/256x256.png",
  "publish": [
    {
      "provider": "github",
      "owner": "me",
      "repo": "POS",
      "private": true,
      "releaseType": "release",
      "token": "<private token>"
    }
  ],
  "target": [
    {
      "target": "nsis",
      "arch": [
        "x64"
      ]
    }
  ]
}
},

my electron.js file or main.js I have :

  win.webContents.on('did-finish-load', () => {
    if(!serve) {
      appUpdater(win);
    }
  });

appUpdater function is:

function appUpdater(win) {
  autoUpdater.autoInstallOnAppQuit = true;
  autoUpdater.autoDownload = true;
  autoUpdater.logger = logger;
  /* Log whats happening
  TODO send autoUpdater events to renderer so that we could console log it in developer tools
  You could alsoe use nslog or other logging to see what's happening */
  let foundUpdate = false;
  autoUpdater.on('checking-for-update', () => {
    dialog.showMessageBox(win, {
      message: 'CHECKING FOR UPDATES !!'
    });
  });
  autoUpdater.on('update-available', () => {
    foundUpdate = true;
    dialog.showMessageBox(win, {
      message: ' update-available !!'
    });
  });
  autoUpdater.on('error', error => {
    autoUpdater.logger.debug(error);
  });
  // Ask the user if update is available
  autoUpdater.on('update-downloaded', (_event, releaseNotes, _releaseName) => {
    let message = 'A new version is now available. It will be installed the next time you restart the application.';
    dialog.showMessageBox(win, {
      type: 'question',
      buttons: ['Install', 'Later'],
      defaultId: 0,
      message: 'A new version has been downloaded',
      detail: message
    }, response => {
      if(response === 0) {
        setTimeout(() => autoUpdater.quitAndInstall(), 1);
      }
    });
  });
  // init for updates
  setInterval(() => {
    if(!foundUpdate) {
      autoUpdater.checkForUpdates();
    }
  }, 60000);
}
exports.appUpdater = appUpdater;

I get documented from auto updater

Auto-updatable Targets is windows nsis

checking-for-update and update-available event fire correctly but update-downloaded or error simply does not fire

Please if you already have experience on this let me know

note: I set environment variable GH_TOKEN in the user machine too

Community
  • 1
  • 1
Lilian Bideau
  • 186
  • 2
  • 15
  • it seems to be a bug I can see here is the fix: https://github.com/electron-userland/electron-builder/releases update electron-builder to latest, but actually it still does not work for me – Lilian Bideau Jan 22 '20 at 06:44
  • Is the NSIS tag really relevant? – Anders Jan 23 '20 at 17:56
  • @Anders what do you mean? I think I get from where the problem come from [here](https://github.com/avocode/electron-windows-autoupdate) it said: _NOTE that in package.json this part:_ `"win": { "certificateFile": "./certs/my_signing_key.pfx", "certificatePassword": "" }` _I generated dummy certificates to sign this app,_ **if you don't provide these files, autoUpdate will not work!** _Replace these lines with your own certificate info_ – Lilian Bideau Jan 25 '20 at 07:53
  • What I mean is, you might be generating a NSIS installer but nothing in your question seems relevant to NSIS. – Anders Jan 25 '20 at 20:27
  • Ok @Anders I just give some more informations about the project in order to know what is going wrong so if you have any remark to make in my code to make it work welcome ! – Lilian Bideau Jan 26 '20 at 04:41
  • I solved it by reverting to "electron-builder@20.38.0" and "electron-updater@4.0.4", – Lilian Bideau Jan 30 '20 at 06:01
  • im having this same issue did you ever solve it? – Martin Mar 21 '21 at 11:34
  • @Martin look my answer – Lilian Bideau Apr 04 '21 at 11:29

2 Answers2

1

Better now than never I was struggling with the new update of mac bigSur as electron-builder@^20.38.0 was giving me very bad errors!!! So I decided to update to the latest version

electron: ^12.0.2
electron-builder: ^22.10.5
electron-updater: ^4.3.8

It was not working at first giving me error like: Cannot download differentially, fallback to full download: Error: Maximum allowed size is 50 MB.

At last my version of node was v10.15.1 locally I updated to v14.16.0 now it works!

Another issue using other versions update and downgrade it was downloading it but failed on install.

Lilian Bideau
  • 186
  • 2
  • 15
1

Same problem with some specifics versions of electron-builder and electron-updater.For me, it works with exactly:

"electron-builder": "22.11.7"
"electron-updater": "4.3.8"

But for instance, it does not work anymore with electron-updater 4.3.9 ...

stephaneb
  • 127
  • 5