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

Suggestion: Do not elevate unless necessary #510

Closed
7 of 20 tasks
rbuckton opened this issue Feb 11, 2020 · 0 comments · Fixed by #511
Closed
7 of 20 tasks

Suggestion: Do not elevate unless necessary #510

rbuckton opened this issue Feb 11, 2020 · 0 comments · Fixed by #511

Comments

@rbuckton
Copy link
Contributor

There are cases where UAC elevation isn't necessary. For example, elevation is not required to create directory symlinks in Windows 10 build 14972 when Developer Mode is enabled, and elevation is not required if the current user owns the %NVM_SYMLINK% directory.

My Environment

  • Windows 7 or below (not truly supported due to EOL - see wiki for details)

  • Windows 8

  • Windows 8.1

  • Windows 10

  • Windows 10 IoT Core

  • Windows Server 2012

  • Windows Server 2012 R2

  • Windows Server 2016

  • My Windows installation is non-English.

I'm using NVM4W version:

1.1.7

I have already...

  • read the README to be aware of npm gotchas & antivirus issues.
  • reviewed the wiki to make sure my issue hasn't already been resolved.
  • verified I'm using an account with administrative privileges.
  • searched the issues (open and closed) to make sure this isn't a duplicate.
  • made sure this isn't a question about how to use NVM for Windows, since gitter is used for questions and comments.

My issue is related to (check only those which apply):

  • settings.txt
  • proxy support (Have you tried version 1.1.0+?)
  • 32 or 64 bit support (Have you tried version 1.1.3+?)
  • Character escaping (Have you tried version 1.1.6+?)
  • A standard shell environment (terminal/powershell)
  • A non-standard shell environment (Cmder, Hyper, Cygwin, git)

Expected Behavior

nvm use <version> should not require elevation when it is not necessary.

Actual Behavior

nvm use <version> prompts for UAC elevation even when in Windows 10 with Developer Mode and the user owns the %NVM_SYMLINK% directory.

Steps to reproduce the problem:

  1. Prereq: Windows 10 build 14972 or later
  2. Prereq: Windows 10 Developer Mode is enabled (under Start > Settings > Update & Security > For developers)
  3. Prereq: Running as a local administrator with UAC prompts enabled.
  4. Set the %NVM_SYMLINK% environment variable to a path that you control:
    SET NVM_SYMLINK=%APPDATA%\nodejs
  5. Run nvm use <version>
  • Notice that a UAC prompt is displayed.
rbuckton added a commit to rbuckton/nvm-windows that referenced this issue Feb 11, 2020
This changes `elevate.cmd` to first try to execute the requested command *without* elevation. If the command failed (i.e., `ERRORLEVEL` was non-zero), then retry the command with elevation.

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

Successfully merging a pull request may close this issue.

1 participant