Search code examples
electronauto-updateelectron-builder

Make electron app oneClick for updates but not for first installation


I'm trying to update my electron app on windows with electron-updater.

It all works except when the updater is running, it first asks the users where does he want to install the software and if the install is meant to be per machine or per user.

I do want these questions to be asked when running the installer for the first time, so my electron-builder.json nsis field look like this:

"nsis": {
    "oneClick": false,
    "perMachine": false,
    "allowToChangeInstallationDirectory": true
},

But I definitely don't want them when it's about updating, the app should detect it has already been installed and not ask anything.

Is there any way to achieve this? (preferably other than having two separate installers, one for the updates and one for the installations)


Solution

  • You are probably using the appUpdater.quitAndInstall(isSilent, isForceRunAfter) method. If you want to prevent the dialog from showing on updates, the isSilent parameter should be true.

    Check the documentation for more details.