Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Npm updates sucessfully, but still shows old version

Tags:

npm

When I do a npm -v I see that I am still on 5.6.0. And keep getting prompts to do a npm i npm.

But I've done a sudo npm install npm@latest -g and double checked with a npm outdated -g --depth=0 to see that my global npm is at the latest already (6.0.0).

How do I resolve this conflict? Is the npm I'm using the latest or is it still the old one? Is it because my global is linked incorrectly or something?

like image 910
Kelvin Zhao Avatar asked Apr 30 '18 00:04

Kelvin Zhao


People also ask

How do I update npm to a specific version?

You can downgrade the npm version by specifying a version in the related commands. If you want to downgrade npm to a specific version, you can use the following command: npm install -g npm@[version. number] where the number can be like 4.9. 1 or 8 or v6.

Does npm update major version?

Keep in mind that with npm update it will never update to a major breaking-changes version. It updates the dependencies in package. json and package-lock. json.

How do I completely uninstall npm?

To completely uninstall node + npm is to do the following: go to /usr/local/lib and delete any node and node_modules. go to /usr/local/include and delete any node and node_modules directory. if you installed with brew install node, then run brew uninstall node in your terminal.


1 Answers

Try closing the Terminal - once you open it again it should work, worked for me well.

*IvanD wrote this solution in a comment to the original post, I thought it's worth an answer post.

like image 140
Eking Avatar answered Nov 08 '22 13:11

Eking