nvm-windows icon indicating copy to clipboard operation
nvm-windows copied to clipboard

Installing nvm-windows on multiple user accounts interferes with each other

Open nbkhope opened this issue 6 years ago • 12 comments

My Environment

  • [X] Windows 10

I'm using NVM4W version:

  • [X] 1.1.5

I have already...

  • [X] read the README to be aware of npm gotchas & antivirus issues.
  • [X] reviewed the wiki to make sure my issue hasn't already been resolved.
  • [X] verified I'm using an account with administrative privileges.
  • [X] searched the issues (open and closed) to make sure this isn't a duplicate.
  • [X] 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):

  • [X] A standard shell environment (terminal/powershell)

Expected Behavior

nvm-windows should work for any user account that installed it, without interfering with the other account.

Actual Behavior

Installing nvm-windows in one account affects the other user account, rendering the former unable to use nvm-windows on the command line.

Steps to reproduce the problem:

Given two user accounts, UserA and UserB on Windows 10.

  1. UserA installs nvm-windows and can use it initially. UserA logs off.
  2. UserB logs in, but cannot use nvm-windows -- his powershell says the command is not found, so he installs nvm-windows during his own session.
  3. After that, UserB logs out and UserA logs back in. UserA can no longer use nvm-windows.

Comments

So is it by design that nvm-windows can only be used by one user account?

nbkhope avatar Dec 16 '17 20:12 nbkhope

Just hit this same issue. It appears to be a result of the default installation folder being located under the install user's home folder. (C:\Users\XXX\AppData\Roaming\nvm) Other users on the machine will be denied access to that folder.

Try removing nvm and re-installing to a common folder location such as "C:\nvm".

JohnMilazzo avatar Dec 28 '17 16:12 JohnMilazzo

@b-dur / @coreybutler - is there a reason any part of NVM needs to be installed globally on a machine? Or maybe rephrased - can't every part of NVM just be installed under Local AppData and the appropriate paths added to the current user's environment? This way any individual user's install of NVM and the currently in-use version of node/npm is completely independent of anyone else's? On Windows 10 anyway, I wouldn't see any problems with this; I'm pretty sure there wouldn't be any under Win7+.

mattzuba avatar Apr 23 '18 17:04 mattzuba

@mattzuba I don't think there is anything blocking NVM for being installed in a global path. This PR #346 should fix this issue when merged.

b-dur avatar Apr 24 '18 05:04 b-dur

I made this pre-release that hopefully should fix this bug: https://github.com/b-dur/nvm-windows/releases/tag/1.1.7 Can anyone confirm that?

b-dur avatar May 11 '18 07:05 b-dur

Thank you for this.

I tried this pre-release on Windows 10. nvm installed into C:\ProgramData\nvm and I was able to access it from an account other than the one that installed it.

I hope I'm not off topic by mentioning this, but I am having one glitch with the environment variables created by this installer. NVM_HOME and NVM_SYMLINK are created as system-level environment variables, and both are inserted into the system-level path as %NVM_HOME% and %NVM_SYMLINK%, but the command interpreter doesn't resolve them into actual pathnames, and thus I can't find the executables. I'm working around this issue by adding %NVM_HOME% and %NVM_SYMLINK% to my user-level PATH environment variable. Windows resolves them into actual pathnames if I do that.

lukeDeanDev avatar May 17 '18 19:05 lukeDeanDev

The problem still persists in the "1.1.7 - Maintenance Release". When I start the setup on a normal user account in Windows 10, I am prompted for an admin password. Later the "Select Destination Location" dialog defaults to the "C:\Users\XXX\AppData\Roaming\nvm" directory, where "XXX" is the admin user.

dkoehler69 avatar Jan 08 '19 17:01 dkoehler69

Same experience with both the previous comments.

bobweil avatar Feb 08 '19 18:02 bobweil

I installed NVM in a global folder like @JohnMilazzo suggested and it started to work AFTER I logged off in all accounts and restarted Windows.

nkovacic avatar Apr 22 '19 07:04 nkovacic

Instalé NVM en una carpeta global como@JohnMilazzosugirió y comenzó a funcionar DESPUÉS de cerrar sesión en todas las cuentas y reiniciar Windows.

esto funciono para mi, lo que hice es instalar en ruta de mi usuario normal y luego reiniciar la PC y funciono

escobaroscar avatar Oct 19 '22 21:10 escobaroscar

Problem still persists. I tried adding the nvm folder to the path for the second user, as well as copying the NVM_HOME and NVM_SYMLINK variables like @lukeDeanDev suggests.

Can someone provide a working workaround? This is quite critical for me.

berzi avatar Jan 03 '23 07:01 berzi

After installing I restarted my PC and nvm started to work , but "node" and "npm" was still not recognized , to make that work I had to run "nvm on" and then I was able to use node and npm commands . More Information

Haris-Oip avatar Feb 20 '23 11:02 Haris-Oip

I installed NVM in a global folder like @JohnMilazzo suggested and it started to work AFTER I logged off in all accounts and restarted Windows.

Just want to say this solution still works originally I could not use NVM on my main user since I have a separate admin user. The fix did not fully take effect until I restarted my computer and dev env. Thanks everyone.

pmfien99 avatar Mar 23 '23 02:03 pmfien99