felixrieseberg/npm-windows-upgrade

How does this deal with the npm paths issue? (Users..AppData vs Program Files)

JoeUX opened this issue · 3 comments

JoeUX commented

Or, what exactly does this module do? I can't tell from the Readme here on Github. The big issue with Windows installs is that node is in Program Files, but npm seems to want to be in the user's AppData path. Anything installed with -g will go to AppData by default. There are two npms in a Windows install, as soon as you use -g. How does this module handle the two separate npms?

Thanks,

Joe Duarte

Exactly - this module finds where npm is currently installed and updates exactly that version.

JoeUX commented

Hi Felix – Sorry, I'm dense. npm is installed in two different places. So when you say that this tool finds where npm is installed and updates that version, which of the two installs are you referring to? A key complication with npm on Windows is the dual install. How does the tool address this? Does it update both installs?
FYI, the npm wiki page that links to your tool is mistaken about the path environment variables. They say that the node installer puts C:\Program Files (x86)\nodejs before C:\Users\<username>\AppData\Roaming\npm, and that this is an issue. I've tested this on Windows 8.1 and 10, and what the node installer actually does is put C:\Program Files (x86)\nodejs in System paths, and C:\Users\<username>\AppData\Roaming\npm in User paths. They're in totally different environment variables – neither one is "before" or after the other. I don't know what the implications of this are.

Hey @JoeArizona - the beauty of open source is that you can just read the source code and find all your answers there. However, to respond to your questions:

  1. If you run npm, a program is run. We find that program - and update it. You can try this yourself with Get-Command npm | Select-Object -ExpandProperty Definition.
  2. System comes before User. To the shell, they're concatenated.