Electron-builder: NSIS Installer stuck at "Installing, please wait..."

Created on 15 Jul 2019  路  52Comments  路  Source: electron-userland/electron-builder


  • electron-builder Version: 21.0.15

  • Target: win10 nsis


Package.json:

"build": {
    "asar": false,
    "win": {
      "target": "nsis"
    },
    "nsis": {
      "runAfterFinish": false,
      "artifactName": "${productName}-${version}-instalador.${ext}",
      "oneClick": true
    }
  }

installer.nsh:

!macro preInit
  SetRegView 64
  WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\${COMPANY_NAME}\${PRODUCT_NAME}"
  WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\${COMPANY_NAME}\${PRODUCT_NAME}"
  SetRegView 32
  WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\${COMPANY_NAME}\${PRODUCT_NAME}"
  WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\${COMPANY_NAME}\${PRODUCT_NAME}"
!macroend

Installer gets successfully built but when executed gets stuck at "Installing, please wait..." forever

Most helpful comment

Any updates on this? This is reported very frequently from our users and we dislike telling them to manually remove a registry key..

All 52 comments

Generally the only time I see this behavior is when an existing install has been deleted rather then explicitly uninstalled via Add Remove Programs or the uninstaller itself.

Yes, the existing install was indeed deleted instead of being uninstalled properly, but the installer should be able to handle this fairly common situation and install it anyway or at least show some kind of error

Generally the only time I see this behavior is when an existing install has been deleted rather then explicitly uninstalled via Add Remove Programs or the uninstaller itself.

For whoever run into this situation, use CCleaner to manually remove the entry from Windows Program list. Then re-run the installer.

For reference, see this page

This is quite confusing for end users, is it able to force re-install new versions?

We've also encountered with the exact same situation. After removing the app's folder manually, the installer kept hanging around nearly half of the process.

but the installer should be able to handle this fairly common situation and install it anyway or at least show some kind of error

Even though it's supposed to be the expected behavior, it's not the case here. We could eliminate the issue by removing the so-called UninstallString registry from the system, for which you should:

  • open Registry Editor
  • click on Edit/Search and search for your application's name

    • (1) note: you could create a backup of your registries by clicking on File/Export

    • (2) note: pay attention to use the exact same name, otherwise the system won't find the appropriate registry

It's quite cryptic why it actually works this way and I'm also not familiar with this whole registry system at all, but hopefully someone will find it useful until there's no explanation/ultimate solution for this issue.

Please also refer to @kebugcheckex's comment. There's a URL which roughly explains how apps can be purged from the system.

@develar This is a rather critical bug. Users who delete the app folder manually or with some weird tools cannot reinstall the app. Is this fixable with a custom NSIS script?

Just ran into this, kind of surprised the installer is completely stuck on this...

We have found that the issue was because of old registry key at Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall, which had the same guid, but without curly braces.
So we had {308cc20e-7a56-5705-91f7-e9a0f443a5cd} as correct one, and 308cc20e-7a56-5705-91f7-e9a0f443a5cd as incorrect one. Deleting 308cc20e-7a56-5705-91f7-e9a0f443a5cd solved the issue.

This is worth noting that we didn't change the appId. it seems like the installer bug in some old version? We currently use electron-builder v22.1.0

This is the problematic commit, which caused breaking change: https://github.com/electron-userland/electron-builder/commit/7518aee8e1abe0516071b350748e84dc47e35cf7

I suggest developers to handle this situation in code so that users of electron-builder won't have to send .reg files to their users :+1:

We have found that the issue was because of old registry key at Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall, which had the same guid, but without curly braces.
So we had {308cc20e-7a56-5705-91f7-e9a0f443a5cd} as correct one, and 308cc20e-7a56-5705-91f7-e9a0f443a5cd as incorrect one. Deleting 308cc20e-7a56-5705-91f7-e9a0f443a5cd solved the issue.

This is worth noting that we didn't change the appId. it seems like the installer bug in some old version? We currently use electron-builder v22.1.0

OMG. This has worked. I don't know what I've actually done.

Removing the old incorrect Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\{308cc20e-7a56-5705-91f7-e9a0f443a5cd} does not work for me. I do this in my custom script, so that users don't see duplicate uninstall entries.

But this does not help when the app folder is manually deleted.

My workarounds for this issue:

!macro customInit
  ; Workaround for installer handing when the app directory is removed manually
  ${ifNot} ${FileExists} "$INSTDIR"
    DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
  ${EndIf}

  ; Workaround for the old-format uninstall registry key (some people report it causes hangups, too)
  ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
  StrCmp $0 "" proceed 0
  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
  proceed:
!macroend

@o2genum could you explain how to use that workaround? I'm getting what appears to be this problem (though we haven't manually removed the files), but I don't understand how to debug or fix it.

For future googlers, to addendum my previous comment: I created an installer.nsh file in my build directory, and filled it with the contents of @o2genum 's post:

!macro customInit
  ; Workaround for installer handing when the app directory is removed manually
  ${ifNot} ${FileExists} "$INSTDIR"
    DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
  ${EndIf}

  ; Workaround for the old-format uninstall registry key (some people report it causes hangups, too)
  ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
  StrCmp $0 "" proceed 0
  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
  proceed:
!macroend

@develar This is a rather critical bug. Users who delete the app folder manually or with some weird tools cannot reinstall the app. Is this fixable with a custom NSIS script?

IMO this is pretty critical indeed. Tried to install an electron-based application, but our company policy didn't allow the installation at first.

After it being allowed and me trying to install it again it got stuck due to this issue

Something that helped me was running CCleaner as recommended by @kebugcheckex and then setting "artifactName": "${productName}.${ext}".

The default artifactName was creating a slightly different installer name each time, which led to auto updates not overwriting the pre-existing program.

I never saw this issue with 20.39.x - I'm pulling my hair out over this bug on literally day 2 after upgrading to the latest electron-builder. If this happened to a user, I can be pretty sure they're never getting this fixed, giving up, and lost to us forever as a user.

THIS IS A CRITICAL BUG

Something that helped me was running CCleaner as recommended by @kebugcheckex and then setting "artifactName": "${productName}.${ext}".

The default artifactName was creating a slightly different installer name each time, which led to auto updates not overwriting the pre-existing program.

Thanks, good to know.
But on the other hand this is not a perfect fix, as the installer now has a name which isn't clearly pointing out the version number.

How do you handle this situation, as i assume all your other builds do feature the version number in the filename

I just ran into this using electron-builder v22.3.2.
The only fix is to remove the specific registry keys under
HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\

@develar hey there, any official plans/workarounds for this?

Any updates on this? This is reported very frequently from our users and we dislike telling them to manually remove a registry key..

We're having this problem too and it's very frustrating

Nightmare issue remains a nightmare.

I think the best part of this issue is probably the fact that the key name is lost, so the entry appears like .../Software/Microsoft/Windows/Uninstall/b8d41b55-5f1c-5d6e-90b0-b704a2b8ba67 - Extremely user friendly for laymen to fix.

We've run into this as well. It seems that updater did something to installation and now user can't install or uninstall the software. Application still works, but yeah. It's not exactly ideal.

I had an issue today where the auto-updater failed and my app became like a zombie - so I manually ran the pending update, and there's this exact issue. So I assume - with why the auto-update wouldn't complete? When I ran it, it got stuck half way and I had to dive into the registry once again.

@Slapbox That's exactly what happened to some of our users. Auto updater fails and then application becomes untouchable be either installer or uninstaller.

It's remarkable to me that on this nearly year old issue, there's a single response from a contributor, and it's to say that they're having the issue also...

Yea, to me its a pretty critical issue and should be higher prioritized. Would give it a shot myself if I was comfortable with the codebase.

We just ran into this.

QA were renaming the install directory, which broke the uninstaller path in the registry, resulting in a hang at new installation with no obvious error. Removing the UninstallString key as mentioned above fixes the problem.

This still happens for our project as well. @develar

Can confirm that this still happens for me as well :(

Happening to us as well, electron-builder version: 22.4.1

I had this issue, like other mentioned, ccleaner. I just dled it, ran it vanilla, and then was able to install again.

The workaround by @o2genum and @rlugge worked for me, but interestingly, I needed to explicitly add "include": "build/installer.nsh" in the nsis key of package.json (running v22.7.0 (latest))

If bugs as serious as this still exist after a year, this repository should be marked as unmaintained. Just saying.

@Borderliner I want to agree with you, but bad maintenance isn't the same thing as no maintenance -- and in this case, I strongly suspect 'bad' is an ugly shortening of 'in way over their heads' maintenance.

I'd just like to see this issue _addressed_. Not fixed, not even a proposed fix, I just want somebody to say, "We know this is an issue."

We just ran into this issue and after spending 20 minutes walking through it with a user (using the solution suggested by @gomorizsolt and @stilettk) and it worked.

Because the registry key is just a bunch of gibberish, it's impossible for us to even give people reasonable instructions to handle this themselves.

Echoing what's been said: even an error message would be far better than the current behavior.

@EmptyCrown I don't think working with registry keys on Windows is that hard of a task electron-builder can't handle. There should certainly be a way to make this automatic, that's why we have "software". But the way this issue is ignored is just sad.

I've just run into the freezing installer problem too.

New to Joplin. Trying to re-install after the old directory got damaged. Seem to remember not being able to originally install it either, but finding an older version that did eventually install, so I assumed it was that.

Back to today.
(Joplin-Setup-1.0.232.exe Win7 SP1) Didn't have a clue where to begin to troubleshoot it. (Did it still support Win7)

Eventually found my way here via Google. Scanned the fix and searched "Joplin" in regedit) only found two entries. One under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall

Removed (both) as suggested.

So. It seems like a trivial fix to me.

  1. Go to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall
  2. Scan it's children for "Joplin"
  3. Delete the node.
  4. Continue the install

Or am I missing something?

Either way I think something needs to be done. Even down to a searchable error message or number to give people a clue as to what the problem is.

Apart from that. It looks interesting, and I look forward to having a play with it.

Don.

Some of my users have been complaining about this issue, though I tried to explain how to manually delete the registry some of them don't feel comfortable in doing it themselves.

We need a fix for this bug

@Numbergod, this fix works when the install dir is removed entirely:
https://github.com/electron-userland/electron-builder/issues/4057#issuecomment-574823454

The bug occurs when the uninstaller in the install directory is missing/damaged/fails for some reason.

That fix works in most cases, except the most subtle ones when the uninstaller is present, but fails due to mysterious reasons.

Thanks for that. But I've managed to install it last week. And the fix is useless to people unless they know why it's failed and can research the fix to find it. Which they can't at present as the installer "just stops" with no information as to why.

As outlined above;
https://github.com/electron-userland/electron-builder/issues/4057#issuecomment-677138839

I think coding a solution that looks for this issue before proceeding is the way to mark this bug as fixed, and help everyone in the future.

Thanks for your assistance, but if the installer checked for, and fixed the issue, I would never have had to spend hours looking into this, fixing my copy, and attempting to get the issue resolved properly.

I'm not sure how this isn't the completely obvious way to fix this issue?

Anyway. Good luck with your project. I look forward to spending more time using it, than I currently have, trying to fix it.

Hit the bug yet again.

Google electron builder "critical bug" and this is the first result.

Could we get _any_ comment on this very serious problem?

This seems to have been fixed by #3782 and #4674

Works with missing/fake broken uninstaller (with random bytes) and with installation dir emptied/removed.

@o2genum #3782 was merged over a year ago and the issue persists.

@Slapbox Sorry, my bad, with the latest electron-builder 22.8.0 issue persists indeed.

I updated my electron-builder and it worked for me only on褋褍 because they changed the Uninstall\{GUID} registry key back to Uninstall\GUID. Looking into the sources.

Apparently, in assisted mode the installer is meant to get stuck until cancelled.

It says "Installation Aborted" and "Setup was not completed successfully" and offers a "Cancel" button.

@develar, I ran in to this too and https://github.com/electron-userland/electron-builder/issues/4057#issuecomment-574823454 resolved it for me.

Are you interested in a PR to make this part of the default nsis install script? Happy to work on that.

@amiller-gh Yes, PR is welcome.

Do we have any sort of fix on the software side of this? Like a setting that can be changes in package.json? Im surprised this has been open for more than a year now.

22.9.1 marked as release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexstrat picture alexstrat  路  3Comments

mstralka picture mstralka  路  3Comments

NPellet picture NPellet  路  3Comments

leo picture leo  路  3Comments

AidanNichol picture AidanNichol  路  3Comments