I am trying to set auto update in my electron mac app. I am using the following code:
const autoUpdater = electron.autoUpdater;
autoUpdater.setFeedURL('https://server_url?v=' + appVersion);
autoUpdater.checkForUpdates();
autoUpdater.on('update-downloaded', function(){
    autoUpdater.quitAndInstall();
});
But I think this statement autoUpdater.quitAndInstall() is not working. The app is not getting quit and relaunching. But if I manually quit the app and reopen, it opens the updated app.
In the app I have a window which is not closable. Is that causing the issue here?
Yes. The non-closable window was causing the issue. I got the solution from electron documentation itself. I used the following code to solve the issue:
autoUpdater.on('update-downloaded', function(){
    mainWindow.setClosable(true);
    autoUpdater.quitAndInstall();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With