coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.07k stars 3.3k forks source link

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

Open nbkhope opened 6 years ago

nbkhope commented 6 years ago

My Environment

I'm using NVM4W version:

I have already...

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

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?

JohnMilazzo commented 6 years ago

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".

mattzuba commented 6 years ago

@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+.

b-dur commented 6 years ago

@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 commented 6 years ago

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?

lukeDeanDev commented 6 years ago

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.

dkoehler69 commented 5 years ago

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.

bobweil commented 5 years ago

Same experience with both the previous comments.

nkovacic commented 5 years ago

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.

escobaroscar commented 1 year ago

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

berzi commented 1 year ago

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.

Haris-Oip commented 1 year ago

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

pmfien99 commented 1 year ago

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.

Knight1988 commented 2 months ago

I remove the NVM_HOME and NVM_SYMLINK on system variable, add it to user variable

image

Then i update the NVM_HOME and NVM_SYMLINK in the Path variable in user variable

image

Repeat same step on another user then 2 accounts would not interferes with each other. Note that NVM_SYMLINK on 2 account must be different path