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

Environment variables duplicated in User Profile and System

Open PlatinumEagle opened this issue 8 years ago • 10 comments

Upon installation on a clean system running Windows 10, the installer creates the following environment variables for both "System" and the current users profile: NVM_HOME NVM_SYMLINK

Furthermore, it appends to the system environment variable for Path, but then also saves the entire Path environment variable under the user profile, erroneously making the actual working path gigantic (since system Path and user profile Path are concatenated). You can confirm by viewing from a new command prompt (started after the installer makes the changes) by typing "path" (or "set" to see all environment variables).

PlatinumEagle avatar Feb 05 '16 01:02 PlatinumEagle

Since default behavior is to symlink into a user profile path, I believe that the correct result of the installer should be to:

  1. Add NVM_Home and NVM_SYMLINK environment variables to the user profile (not to system) 2) Append %NVM_HOME%;%NVM_SYMLINK% to only the Path environment variable for the user profile (not to the system).

PlatinumEagle avatar Feb 05 '16 01:02 PlatinumEagle

After installing nvm I had the issue that the nvm command was not recognised. After I changed my environment variables to what PlatinumEagle suggested (variables and path in user profile) it worked. So I would +1 the suggestion of PlatinumEagle.

gingters avatar Mar 05 '16 12:03 gingters

@gingters - which version of Windows are you running this on?

This was a requirement on Windows 8.0. The whole variablized PATH was created so the software could easily be uninstalled later. This choice was motivated by challenges with the InnoSetup installer. However; this whole process will likely be scrapped in favor of far simpler uninstallation support with the BitRock installer.

I'm leaving this open for now. I'll close it when I finally get around to releasing the next installer.

coreybutler avatar Mar 16 '16 21:03 coreybutler

Just installed today on a new pc running Windows 10 and ran into this issue.

+1 to @PlatinumEagle 's fix

ashleahhill avatar May 28 '16 20:05 ashleahhill

I have the problem that I have two account at my work. a "normal-user" and a "admin-user". If I install nvm he writes the env values to the "admin-user".

but normally i run nvm with the "normal-user" and than he dont know node or nvm as a command, because the path command gives me: PATH: ...C:\Program Files\TortoiseGit;%NVM_HOME%;%NVM_SYMLINK% Maybe don't use vars for the path?

Thanks!

crazyx13th avatar Jul 08 '16 09:07 crazyx13th

@crazyx13th - which version of Windows are you on? Some people have experienced problems on Windows 8 with the variable approach.

coreybutler avatar Jul 08 '16 16:07 coreybutler

Win7 x64, but I think the Problem is that the account for installing nvm and the account for using nvm are nor the same. thx

crazyx13th avatar Jul 09 '16 05:07 crazyx13th

@crazyx13th - NVM4W sets the PATH at a system level, so it should be available to all accounts. If the account doesn't have administrative privileges, then many features won't work, but it shouldn't prevent you from running a node script under a normal account.

On Windows 7, which is unsupported (reached EOL), you can manually change the variables to the physical path.

coreybutler avatar Jul 09 '16 16:07 coreybutler

yeah, this was my solution at my agancy too. set the path manually. but then all is working! only if i want to change a version I had to insert my admin pwd, but this is no problem...

crazyx13th avatar Jul 10 '16 07:07 crazyx13th

Leaving myself this note to check in the Chocolatey package I'm updating to add an option to create User only for the NVM_* variables and update the USER's path as well as the option to install everything system-wide (the default since much of chocolatey gets used for automation where USER only settings aren't valuable).

espoelstra avatar Nov 08 '16 00:11 espoelstra