I am using npm v5.3.0. Now I want to update npm to v5.4.1.To do this I type the following in my terminal:
npm install -g npm
without any errors.Howe
I had to dig a little bit more (probably I have some misconfig) and take an hardcore approach...
First I ran which npm
to get the script that was running, that was /usr/local/opt/node@8/bin/npm.js
.
From that script I saw that the npm package was actually in /usr/local/opt/node@8/lib/node_modules/npm
.
So I ran
cd /usr/local/opt/node@8/lib/
npm i npm@6.11.2 # or your desired version
rm package-lock.json # clean up
And that did the trick, hope it helps someone :)
NB: I'm not saying that you should do this right away, first is better if you try the other approaches but if other approaches are not working give it a shot