Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update is downloaded but not installed, if application was installed for all users (in Program Files) on Windows #4474

Closed
DominikLevitsky opened this issue Nov 27, 2019 · 17 comments
Labels

Comments

@DominikLevitsky
Copy link

  • electron-builder:
    22.1.0
  • electron-updater:
    4.2.0
  • Target:
    nsis

Settings:

    "nsis": {
      "oneClick": false,
      "allowToChangeInstallationDirectory": true,
      "allowElevation": true,
      ...
     }

Steps to reproduce:

  1. Build electron app, and put the version to lets say 1.0.0;
  2. Build nsis target and artifacts for auto-update (latest.yml);
  3. Build the app again, put the version to lets say 1.0.1, also build artifacts (latest.yml);
  4. Upload the 1.0.1 version to your server, or wherever, just so 1.0.0 can see it;
  5. Launch the 1.0.0 app. Wait for the update to download, app relaunches to update. So far so good.
  6. Now, if the app was installed for single user (to C:/Users/User/AppData/Local/Programs/...) everything is fine, the app is uninstalled, then the 1.0.1 version is installed, all good.
    But if the app was installed for all users (to C:/Program Files/...) the UAC dialog launches, asking for permission (as expected), the app is uninstalled (as expected), but then it is not installed again (totally unexpected). No errors, no warning, no nothing.

I will be happy to provide any other info if needed.

@kzimny
Copy link

kzimny commented Nov 27, 2019

Indeed very strange. Can you try to start your exe from command line and see what happen in the console? Did you already try on another PC?

@DominikLevitsky
Copy link
Author

@kzimny What exe and when exactly? The main app exe? Or the app installer exe? It installs totally fine to any location, when installed manually.

@DominikLevitsky
Copy link
Author

Probably worth mentioning, the app-updater folder (in C:/Users/User/AppData/Local/app-updater/pending/update-info.json) has the property "isAdminRightsRequired": false, shouldn't it be set to true, actually, if the app is installed in the Program Files for all users?

@kzimny
Copy link

kzimny commented Nov 27, 2019

The exe file launch in step 5 from C:/Program Files/MyApp/myapp.exe.
Look at #4312. Maybe similar issue?

@DominikLevitsky
Copy link
Author

Okay, running it as Administrator allows it to install properly. I think it is the same as #1129
@develar Can you look into this?

@damianobarbati
Copy link

@DominikLevitsky did you solve this?

Not sure is related but my NSIS installer just dies in the middle of installation progress, no matter if I run it as administrator. NB: it starts installing.
This is breaking my users auto-update (and causing an infinite loop of installations...).

How can I debug the NSIS installer created by electron-builder?

"nsis": {
    "oneClick": false,
    "perMachine": true,
    "allowElevation": true,
    "deleteAppDataOnUninstall": true,
}
...
"electron": "^7.1.3",
"electron-builder": "21.2.0",

@DominikLevitsky
Copy link
Author

@damianobarbati We solved the install issue using this:

    "win": {
     ...
      "requestedExecutionLevel": "highestAvailable"
    }

But it seems like a temporary solution only, because now, it always asks for admin permission on every app opening, which is not acceptable. I wish someone could help to fix this.

@damianobarbati
Copy link

@DominikLevitsky thanks for helping. Unfortunately that's not working for me, the installer keep just dying.

@jypdapeng
Copy link

解决了吗?

@stale
Copy link

stale bot commented Feb 18, 2020

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.

@stale stale bot added the backlog label Feb 18, 2020
@stale stale bot closed this as completed Feb 25, 2020
@adambailey-
Copy link

We also have this problem.

@Dysey
Copy link

Dysey commented Mar 26, 2020

some infos @adambailey- ? @damianobarbati

@rasgo-cc
Copy link

rasgo-cc commented Oct 12, 2020

Same issue here. Anyone willing to work on this? Any useful pointers?

PS: I'm using "electron-builder": "^22.8.0" and "electron-updater": "^4.3.4"

@ajgassner
Copy link

I had the same issue when calling the updater with silent option: autoUpdater.quitAndInstall(true, true)
My workaround is to ask the win registry if my installation is machine-wide before calling quitAndInstall:

using https://github.com/ironSource/node-regedit

// there is an issue with silent update and machine wide installation, see https://github.com/electron-userland/electron-builder/issues/4474
// UUID is automatically generated from appId, so do not change appId!
const REGISTRY_KEY = 'HKLM\\SOFTWARE\\<<REMPLACE_ME_WITH_UNIQUE_APP_ID>>';
let silentUpdate = true;
regedit.setExternalVBSLocation('resources/regedit/vbs');
if (process.platform !== 'darwin') {
  regedit.list(REGISTRY_KEY, (error, result) => {
    if (error) {
      logger.info("no machine wide installation found");
      return;
    }
    if (result && result[REGISTRY_KEY] && result[REGISTRY_KEY].values && result[REGISTRY_KEY].values['InstallLocation']) {
      const machineWideInstallLocation = result[REGISTRY_KEY].values['InstallLocation'].value;
      if (path.dirname(app.getPath("exe")) === machineWideInstallLocation) {
        logger.info("machine wide installation found: " + machineWideInstallLocation);
        silentUpdate = false;
        return;
      }
    }
    logger.info("no machine wide installation found. no match");
  });
}

package.json:

"build": {
  "win": {
    "extraResources": [
      {
        "from": "app/node_modules/regedit/vbs",
        "to": "regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]
  },
...

then call autoUpdater.quitAndInstall(silentUpdate, true)

@majorgeek85
Copy link

Hi,

I have Electron-updater on 4.3.8 (last version), electron builder on 22.10.5 (last version) and I still have exactly the same problem as the OP.

Any pointers would be much appreciated.

Best Regards,
Nelson Oliveira

@ElectroBuddha
Copy link

Should be solved in electron-updater v4.6.5 by #6450

@veecam
Copy link

veecam commented Dec 16, 2021

@damianobarbati We solved the install issue using this:

    "win": {
     ...
      "requestedExecutionLevel": "highestAvailable"
    }

But it seems like a temporary solution only, because now, it always asks for admin permission on every app opening, which is not acceptable. I wish someone could help to fix this.

Oh my godness, you saved me! It took me a whole day to find a solution until I saw your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests