I have created an installer using electron-builder settings below:
"build": {
"productName": "MyApp",
"appId": "com.MyApp",
"extraResources": [
{
"from": "./someApp/someApp.exe",
"to": "someApp.exe"
},
{
"from": "./someApp/someApp.config.yaml",
"to": "someApp.config.yaml"
}
],
"directories": {
"output": "build"
},
"files": [
"dist/electron/**/*"
],
"win": {
"icon": "build/icons/icon.ico",
"requestedExecutionLevel": "requireAdministrator"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true
}
},
I have installed the app on few machines and there were two PC where I couldn't install it. Here is what I get:

it says: Installation Aborted. Setup was not completed successfully.
I have no idea why this happens, and how to fix it. Does anybody know why it might happen?
This problem appears on two machines out of 7 I have tested so far. Both run windows 10.
Same problem with @Zver64 .
I use [email protected] build on window 10.
Same issue for me using 20.43.0
Upgraded to 20.44.4, no difference
Downgraded to last known working version, 20.38.5 and works fine again, installed/upgraded no problem
config:
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true
},
app was built on Mac.
Maybe related to upgrading as the installer says an existing installation was detected. I haven't yet tried in as a clean install. Will do a bit more testing later.
Another one: https://github.com/electron-userland/electron-builder/issues/4057
I am experimenting with settings as well. I removed perMachine and now it works perfectly on one of test machines, but not on another one. I am able to install it for current user only. But not for all users.
The installation aborts immediately after clicking the "Install" button on the choose install location dialog.
I noticed when the installer detects an existing installation making the app install as an upgrade, the installation path was listed as \AppData\Local\Programs\<packagejson.name>\<packagejson.build.productName> however the <packagejson.name> part did not match what i currently have in my package.json file, it instead was matching the existing installation directory path found in the registry at HKEY_CURRENT_USER\Software\<installation-guid>\InstallLocation
At some point in the past i implemented testing and staging builds by changing the package.json "name" and "build.productName" properties. Initially i was only changing the "build.productName" and 'build.appId" properties which did not actually change the installation directory and add-remove-programs / registry entry until i found out about "build.extraMetadata" which also allowed the 'name" property to be changed. It looks like i had an existing installation with the intended productName but the name left unchanged, making the installer detect the productName and try to use an incorrect installation directory found in the registry.
I tried installing as a fresh installation, deleting the app dir from %USERPROFILE%\AppData\Local\Programs\<packagejson.name>did not make the installer think that the app is not installed, uninstalling from add-remove programs also did not do the trick. It looks at the registry key in HKEY_CURRENT_USER\Software\<installation-guid> which seems to have been left behind during the uninstall. Once that is deleted it installs as a fresh installation.
Installing as a fresh installation solved the issue and i was also unable to recreate the issue by upgrading. I tested it by creating 3 builds using 20.38.5, 20.43.0 and 20.44.4 and them installing them in sequence.
It seems that the issue was caused by the presence of a previous installation built using a different configuration of package.json name and build.productName settings. I think some work needs to be done to improve the error handling here as it does not fail nicely. I also could not find any installation logs, although it didn't spend too long looking, anyone know where to find them?
Ok, seems like the above is not the complete story, there seems to be an issue with the installation directory depending if a one-click unattended installer or an attended installer is created.
I recently added this section to my package.json build config:
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true
},
Without the above section, an unattended one-click installer is created which on a clean installation installs the app into: \AppData\Local\Programs\<packagejson.name>\ so unless you use the "build.extraMetadata" option to change the "name" property, multiple apps with different "productName" values overwrite each other despite creating separate registry entries and desktop shortcuts (which seem to be based on the productName.
When adding the above config which creates the attended installer, on a clean install the app is installed into: \AppData\Local\Programs\<packagejson.build.productName> allowing separate app installations to be created without having to change the "name " property.
If the app is installed first using the one-click installer and then installed over the top using the attended installer, the attended installer detects an existing installation at \AppData\Local\Programs\<packagejson.name>\ , then removes the contents of the directory and installs the app at: \AppData\Local\Programs\<packagejson.name>\<packagejson.build.productName> instead of \AppData\Local\Programs\<packagejson.build.productName>
uninstalling the app then leaves behind an empty \AppData\Local\Programs\<packagejson.name>\ directory but does correctly remove the registry entries.
I was not able to reproduce the issue by performing the above steps, so likely it was caused by the changes i had made over time.
If the app is installed first using the one-click installer and then installed over the top using the attended installer, the attended installer detects an existing installation at
\AppData\Local\Programs\<packagejson.name>\, then removes the contents of the directory and installs the app at:\AppData\Local\Programs\<packagejson.name>\<packagejson.build.productName>instead of\AppData\Local\Programs\<packagejson.build.productName>
I have the same issue when using:
{
"oneClick": false,
"allowToChangeInstallationDirectory": true
}
and custom "customRemoveFiles" macro which leaves the app folder and one of my subfolders. Here is the issue: https://github.com/electron-userland/electron-builder/issues/4056
Looks like if the folder where you want to install your app already exists and it's not named as your "build.productName", then it will create a subfolder named as in your "build.productName" and install the app in it.
Hey, some of my users are also reporting this issue. Is there any debug logs or something to try and resolve the issue?
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true
}
My installation config is similar to the original one...so this means the installation is in C:\Program Files\{APP_NAME} by default.
There is still a directory located in AppData\Roaming\{APP_NAME}...but this is basically just the electron stuff located there like cookies, caches, storage, etc.
Is there a complete solution here to fix this? Some of my users are claiming to do full uninstalls, reinstalls, etc but still not having any luck...
So I had a user that reported this error...and I was able to fix it. It basically relates to: https://github.com/electron-userland/electron-builder/pull/4069 (at least for me).
I deleted the old bad GUID Uninstaller from the registry and then the installation worked with no issues. Here is the code I used in nsis to basically do this:
# For my application GUID (fix GUID to match what your application uses)
!define NEW_GUID_INSTALLER "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1de14785-dd8c-5cd2-aae8-d4a376f81d78}"
!define OLD_GUID_UNINSTALLER "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\1de14785-dd8c-5cd2-aae8-d4a376f81d78"
!macro customInit
// Checks for if already updated to new version...so we can remove the old entry
Call CheckForNewInstallation
!macroend
!macro customInstall
// Remove old entry for installation for sure now if it exists, because we just installed the client
Call CleanOldInstallation
!endmacro
Function CheckForNewInstallation
# Preserve stack
Push $R1
# Check if new electron app is installed
ReadRegStr $R1 HKLM "${NEW_GUID_INSTALLER}" "Publisher"
# Check if this key exists or not
StrCmp $R1 "{YOUR_PUBLISHER_NAME_HERE}" DeleteOldInstallation SkipOldInstallation
DeleteOldInstallation:
Call CleanOldInstallation
SkipOldInstallation:
# Restore stack
Pop $R1
FunctionEnd
Function CleanOldInstallation
# Preserve stack
Push $R0
# Check if old BL is installed
ReadRegStr $R0 HKLM "${OLD_GUID_UNINSTALLER}" "Publisher"
# Check if this key exists or not
StrCmp $R0 "{YOUR_PUBLISHER_NAME_HERE}" DeleteOldEntry SkipOldEntry
DeleteOldEntry:
# Just blindly ignore errors...worst case it does nothing harmful
DeleteRegKey HKLM "${OLD_GUID_UNINSTALLER}"
SkipOldEntry:
# Restore stack
Pop $R0
FunctionEnd
Still having issues on this even with the above macro/attempts to fix it.
Seems to also happen sometimes with the new GUID as well.
Tagging @develar to try and take a look at this, as it's a pretty widespread problem since upgrading electron-updater and electron-builder for my users.
Really wish there was more detailed output from nsis as to what failed.
Also related to: https://github.com/electron-userland/electron-builder/issues/4092
Several problems/issues between uninstallation and installation.
We have a similar issue: #4474 It seems if the "perMachine" is not set, the auto-updater picks the default as for current user, and then the old installation is deleted, but the new one is not installed.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any updates regarding this?
I can confirm the issue. Upgrading electron-builder

and changing the nsis configuration

results in problems with installing the new package over an existing installation:

The new installer might work on a second try, which will also result in a non-updated + broken installation entry in the Windows programs list.
@Zver64 IMO this should be reopened
Seems to still be a problem, please re-open!
Still an issue. Please reopen
Still an issue. Please reopen
I can confirm the issue. Upgrading electron-builder
and changing the nsis configuration
results in problems with installing the new package over an existing installation:
The new installer might work on a second try, which will also result in a non-updated + broken installation entry in the Windows programs list.
@Zver64 IMO this should be reopened
I am no longer working on the project where I had this issue, but looking at the coments above it indeed seems to be a relevant issue. Although I don't know how to reopen it.
A few of my users are also having this issue. Hoping this issue could still come back to surface
Definitely still seems to be an issue. Occuring for my users with electron-builder 22.6.0
Also in electron-builder 22.3.2. Please reopen.
I've found a solution. If you're on Windows, open Programs and Features, look for your app and click uninstall. Windows had the application in cache and NSIS doesn't let you install the app if it already exists in cache.
@Zver64 please reopen it.
Same problem here with electron-builder 22.7.0.
I sometimes have to manually remove uninstaller registry entries to proceed with a fresh install.
Same experience for me and many of my users - registry entries are not removed when uninstalled on Windows using NSIS, have to manually go in and delete registry entries before you can proceed with a new install.
Please re-open this issue @develar, there's a lot of evidence in this thread to support this remaining an active problem.
I'm currently not able to dive deeper into the topic but I ran into the same troubles today. This is my setting:
"nsis": {
"oneClick": "false",
"perMachine": "false",
"allowToChangeInstallationDirectory": "true",
"packElevateHelper": "true"
}
But - I was actually able to fix the broken installation process simply by updating electron and electron-builder:
"electron": "^9.1.0",
"electron-builder": "^22.7.0"
The project was using electron ^7.1.3 and electron-builder ^21.2.0 beforehand. Maybe that's a help for someone :-)

May this way work..?? i must install it in this mount point for a reason but installation never be completed
my build/installer.nsh
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\data_d\CS_Dashboard"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\data_d\CS_Dashboard"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\data_d\CS_Dashboard"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\data_d\CS_Dashboard"
!macroend
my package.json
...
"win": {
"icon": "./icon/win32.ico",
"target": [
{
"target": "nsis"
}
],
"requestedExecutionLevel": "requireAdministrator"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"perMachine": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"include": "build/installer.nsh"
}
...
"electron": "^10.1.2",
"electron-builder": "^22.8.0"
same problem here. I just want to install the program to the program file folder rather than the AppData folder
electron
maybe you need clear the old registry value.. i am using revo uninstaller for cleaning old registry and cache..
Most helpful comment
I can confirm the issue. Upgrading electron-builder



and changing the nsis configuration
results in problems with installing the new package over an existing installation:
The new installer might work on a second try, which will also result in a non-updated + broken installation entry in the Windows programs list.
@Zver64 IMO this should be reopened