0

Recently I have created a new user on Windows 10 and removed the old user, after that when I try adding an global npm package it get installed on the previous user %appdata%/Roaming directory. I'm not able to use those global libs now.

Say for example

npm install -g gulp

installs the gulp module under

C:\Users<DELETED_USER>\AppData\Roaming\npm\gulp

and not found in the new user directory

C:\Users<NEW_USER>\AppData\Roaming\npm\gulp

Is there any npm config I have to touch to fix this issue?

RobC
  • 22,977
  • 20
  • 73
  • 80
Gowtham S
  • 923
  • 14
  • 39

1 Answers1

1

When you run the following command:

npm config get prefix

it probably prints:

C:\Users\<DELETED_USER>\AppData\Roaming\npm\

If that's the case, i.e. it references the pathname to the <DELETED_USER>, then consider utilizing the npm config command to change the prefix value. E.g.

npm config set prefix "C:\Users\<NEW_USER>\AppData\Roaming\npm"

If you also run the following command:

run npm config ls -l

you may find other configuration properties (e.g. cache) whose values contain the <DELETED_USER> pathname in them too. For those also consider setting them as necessary using: npm config set <key> <value>

RobC
  • 22,977
  • 20
  • 73
  • 80