question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nsis can't install the app for all users on some PC

See original GitHub issue
  • Version: 20.44.4
  • Target: windows

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: image

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:30 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jmeinkecommented, Mar 1, 2020

I can confirm the issue. Upgrading electron-builder electron-builder and changing the nsis configuration BreakIt results in problems with installing the new package over an existing installation: Installer-Hangs

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

3reactions
chrisckccommented, Jul 18, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AllUsers/CurrentUser install without elevation - NSIS Forums
AllUsers /CurrentUser install without elevation. I've got a game application that I'm trying to write an installer for.
Read more >
Complete Guide: How to Fix NSIS Error Windows 10
The NSIS error is an issue that commonly comes up when you're installing a program. How to deal with this error? This post...
Read more >
NSIS Error - STILL not working. - Microsoft Community
If the NSIS cannot install something, the error which occurs could be due to several reasons. For example, improper configuration settings, ...
Read more >
Why do I get NSIS Error?
The installer has failed a self-check. This means that for some actions, the installer file has been altered from its original form. If...
Read more >
Installed NSIS application is not shown in start menu/system ...
Use SetShellVarContext to switch constants to "all users"/machine mode: RequestExecutionLevel Admin Function .onInit SetShellVarContext All ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found