6

Problem

I need to install nvm for windows 10 and have it work for my admin profile and my non admin profile. When I do all my programming it's with my regular user account. But to install things / admin stuff, I have to provide an admin account.

Details I downloaded and ran the latest installer from this repo:

install nvm for windows 10: https://github.com/coreybutler/nvm-windows

WHen I try to run the installer, I have to use my admin account. Windows prompts me for it and after I supply the creds, the setup completes without any issues. The problem is that nvm only works when I run a command window as my admin user ... but I need to be able to run nvm as my regular non priv. user as well.

So right now, when I open a "command" window as admin, i can run

Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>nvm --version

Running version 1.1.9.

But if I run command just as my regular user,

Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.

C:\Users\me>nvm --version
'nvm' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\me>

Any tips would be appreciated.

EDIT 1

enter image description here

enter image description here

dot
  • 14,928
  • 41
  • 110
  • 218
  • Can you share your user and system environment variables (specifically, the PATH)? – Mureinik Dec 17 '21 at 14:07
  • @Mureninik so i've tried to do that.. I open system properties - which forces me to provide admin creds. then when it opens, I can see that I have some new nvm related variables under the section "User variables for " and then i see the same variables under the "System variables" section. – dot Dec 17 '21 at 14:19
  • Does the PATH variable (in either the user or system variables) refer to nvm? – Mureinik Dec 17 '21 at 14:23
  • @Mureinik please see the "Edit 1" section. I updated with screen shots so you can see what the installer added. fwiw. the path to AppData ... I used my regular user account. But that clearly didn't help. – dot Dec 17 '21 at 14:32
  • For me, it just required system restart, have a look at this git comment - https://github.com/coreybutler/nvm-windows/issues/325#issuecomment-354313440 – Paritosh Dec 07 '22 at 15:22

3 Answers3

4

Used the registry editor to add 2 new string varaibles to the regular user's profile. Can't do it through the Control Panel GUI because I'm always forced to use elevated credentials to access the control panel. And then when I do edit the User's environment vars, it's for the admin account only. So now when I open up a command window and run the "set" command, it includes these two variables:

NVM_HOME=C:\Users\<nonAdminUser>\AppData\Roaming\nvm
NVM_SYMLINK=C:\Program Files\nodejs

And now everything just works.

dot
  • 14,928
  • 41
  • 110
  • 218
  • 1
    Hi @dot, I have the same problem and can't figure out how do you achieve to make it work. Can you please explain in detail how do you have added the variables to the non-privileged user? – pcasme Nov 10 '22 at 10:40
  • 1
    And I see that you point to the folder path of the non-privileged user (/AppData/Roaming/nvm) but in there there isn't installed nvm. I mean, when you install it, as you pointed out, the installation runs under the Admin account and therefore the installation goes to the /AppData/Roaming/nvm. So I can't figure out how or why it is working for you. Can you explain if you did any further steps to achieve this. Thanks in advance. – pcasme Nov 10 '22 at 10:40
1

In my case it works without registry editing:

  1. Switch to admin account
  2. Go to nvm folder and add share it with user.
  3. Switch to user account.
  4. Add %NVM_HOME% and %NVM_SYMLINK% to user PATH variable
  5. Restart cmd.
AlexK
  • 43
  • 5
1

I had the same issue. After installing it, I couldn't run nvm or node from my normal account. Rebooting did not help. I even had a difficult time uninstalling it so that I could try again due to permissions.

I did the following on my second attempt and it seems to have worked. It even created the correct environment variables under my normal account, which was a bit surprising. Regardless, it worked for me, so I thought I'd share in case it helps someone else.

  1. Run the installer.
  2. When prompted, enter admin credentials.
  3. When it asks for the install location, I change the username portion of the path to be my non-admin username.
  4. Ran the rest of the installation as normal.

After doing the above, I was able to run nvm under my normal account. When switching to a specific version of Node with "nvm use xx.xx.x" I was prompted to enter my admin credentials, but once it finished I was able to use node with my normal account.

klaust
  • 91
  • 4