- Electron-Builder Version: 26.8.2
- Node Version: 24.14.0
- Electron Version: 40.1.0
- Target: NSIS
When using NSIS multi-user mode (oneClick: false) with selectPerMachineByDefault: true, a fresh silent install (/S) does not trigger UAC and fails due to insufficient privileges.
Running the silent installation from an administrator console works correctly.
To Reproduce
- Configure NSIS:
oneClick: false
perMachine: false
selectPerMachineByDefault: true
- Run fresh install as non-admin:
- The app is not installed, no error is displayed.
Suspected root cause
In packages/app-builder-lib/templates/nsis/installer.nsi, UAC in silent mode is triggered only when there is a previous per-machine installation, the resolved mode is ignored:
|
${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser |
|
${andIf} ${Silent} |
Proposed fix
Broaden condition to include resolved per-machine mode:
${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser
${OrIf} $installMode == "all"
${andIf} ${Silent}
When using NSIS multi-user mode (
oneClick: false) withselectPerMachineByDefault: true, a fresh silent install (/S) does not trigger UAC and fails due to insufficient privileges.Running the silent installation from an administrator console works correctly.
To Reproduce
oneClick: falseperMachine: falseselectPerMachineByDefault: trueMyAppSetup.exe /SSuspected root cause
In
packages/app-builder-lib/templates/nsis/installer.nsi, UAC in silent mode is triggered only when there is a previous per-machine installation, the resolved mode is ignored:electron-builder/packages/app-builder-lib/templates/nsis/installer.nsi
Lines 101 to 102 in ed422f3
Proposed fix
Broaden condition to include resolved per-machine mode: