02 Sep 2017

This article will take about 1 minute to read.
1 Comment

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.

Category
JavaScript

Comments (1)

Ethan
17 Jun 2018, 04:09 PM

Easier way is simply to do an npm global install, which would automatically use the correct path to the current nvm version in use.

npm install -g npm

Leave a comment

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