1

I just had a trouble to upgrade my npm version from 5.0.0 to 6.4.1 on Windows 10.

What i did was just downloading NodeJS (latest) installer, i.e. 8.12.0 (it includes npm 6.4.1). It was successfully installed, however when i did npm -v it still on version 5.0.0, so it only updated the node part only.

Then i follow this instruction (link), basically it uses npm package called npm-windows-upgrade, at first try it threw a lot of error.

Basically i have to do several cycles of NodeJS uninstall, NodeJS reinstall, and executing npm-windows-upgrade, after few times it finally succeeded (luck), now my npm is at 6.4.1. However when i run where npm on terminal it listed two locations of my npm files:

C:\WINDOWS\system32>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\XXX\AppData\Roaming\npm\npm
C:\Users\XXX\AppData\Roaming\npm\npm.cmd

and this is kind of strange, it should only listing one location, i.e. C:\Program Files\nodejs\.. but apparently i have npm too on AppData\Roaming directory, why is this happening? should i delete the second one?

PS - If i run where node, it listed only one location, i.e:

C:\WINDOWS\system32>where node
C:\Program Files\nodejs\node.exe
xcode
  • 1,637
  • 3
  • 16
  • 25

1 Answers1

0

C:\Users\xxx\AppData\Roaming\npm is the location for node packages for the current user, while C:\Program Files\nodejs\ is the installation dir for all users.

See what C:\Users\XXX\AppData\Roaming\npm\npm.cmd -v returns. If it's the same as npm -v then you are fine.

You could run node without the installer, in this case C:\Program Files\nodejs\ would not be in the PATH (for System env variables), however all the global packages would be placed under C:\Users\XXX\AppData\Roaming\npm\. Since npm is a global package, it appers there.

TL;DR No action required.

mihai
  • 37,072
  • 9
  • 60
  • 86