How to update npm using nvm

02 Sep 2017

& Rants

By Muffin Man

This article will take less than 1 minute to read.
No comments

If you are JavaScript developer and not using nvm you might want to look at it. Node Version Manager is easy way to install, manage and work with multiple node versions.

And I recently got npm update notification, that looks like this:

npm update notification

This is image from the internet.

nvm doesn’t let you update only npm, but just a node+npm version. But there is a really easy way to do it:

# navigate to nvm's node lib folder
# (replace v8.4.0 with your version)
cd ~/.nvm/versions/node/v8.4.0/lib/

# update npm right there
npm install npm

# reopen your terminal

That’s it. Great thing is that npm can update itself. And this works for any other global npm package.

Share on

No comments, be the first to comment

Sending failed, please try again.
Thank you! Your comment is sent. Please note that all of the comments go through moderation.