electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.7k stars 1.74k forks source link

Application can't install update #6973

Open bruteforce1414 opened 2 years ago

bruteforce1414 commented 2 years ago

I can't install downloaded updates on windows 10

Event 'update-downloaded' fires, dialog.ShowMessageBox appears, I press button "Install and Restart" but nothing happens. Logs demonstrates, that button wasn't pressed.

Code for event:

autoUpdater.on('update-downloaded', () => {
  log.info('update-downloaded');

  sendStatusToWindow('Update downloaded.');
  updateDownloaded = true;
  changeUpdaterMenu({ label: 'Updates available', enabled: true });
  if (isSilent) return;
  dialog.showMessageBox({
    title: 'Install Updates',
    message: 'Updates are ready to be installed.',
    defaultId: 0,
    cancelId: 1,
    buttons: ['Install and restart', 'Close']
  }).then(buttonIndex => {
    if (buttonIndex === 0) {
      log.info("buttonIndex", buttonIndex)
      setImmediate(() => autoUpdater.quitAndInstall());
    } else {
      changeUpdaterMenu({ label: 'Updates available', enabled: true });
    }
  })
    .catch(() => {
      log.info("buttonIndex", buttonIndex)
      autoUpdater.checkForUpdates()
    });
});
mrozekadam commented 2 years ago

I have a similar problem. My app is missing latest.yml and resources/auto-update.yml files after build. I recomend you check it out in your dist folder. If latest.yml or auto-update.yml files are missing, you have the same problem as me.

I'm building it with vue-cli-electron-builder (https://nklayman.github.io/vue-cli-plugin-electron-builder/). I recomend using code below to enable autoUpdater logging. If you install the app you can navigate to C:\Users\{username}\AppData\Roaming\{app-name}\logs\main.log and see the error. In my case it says that the app-update.yml file was not found.

If I'll manage to find the solution to my problem I'll share it here (edit this post)

const log = require('electron-log');
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
github-actions[bot] commented 5 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.