I want my npm
version to match my node
version but no matter what node
version I change it to with the n library the npm version is always 8.19.2. I am on a MAC running Monterey.
Asked
Active
Viewed 996 times
1 Answers
1
You probably have more than one version of npm installed and in your PATH
, and the version that n
is updating is not the first npm found.
Where is the active npm installed? The default location that n
installs to is:
$ command -v npm
/usr/local/bin/npm
If your OS has which
, you can see all the locations at once (I just have one installed):
$ which -a npm
/usr/local/bin/npm

shadowspawn
- 3,039
- 22
- 26
-
I have `prefix=/Users/jisay93/.npm` in my `.npmrc` file in order to avoid using sudo with npm. `which -a npm` gives me `/usr/local/bin/npm /Users/jisay93/.n/bin/npm` I think `n` is changing the npm at `/Users/jisay93/.n/bin/npm` but when I run npm it is running the other npm. I have tried `sudo npm uninstall npm` but depending on which terminal window I run it in I either get an error or it completes but still shows npm at `usr/local/bin/npm`. I should have said I am on a mac. – ponder275 Nov 03 '22 at 13:24
-
It looks like the issue was Webstorm placed a npm alias in `user/local/bin/npm`. I deleted it and now `which -a npm` only shows the `n` library version. I would not have found this without your help. Thanks! – ponder275 Nov 03 '22 at 16:03