Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Update npm to the Latest Version

Check your npm version and update it on Linux, Windows and macOS, or with nvm.

How-To Guides2 min read4 steps

Why keep npm updated

Newer npm versions fix bugs and security problems, install packages faster and support new features.

Check the current version

npm -v

You can see the latest version with:

npm view npm version

Update npm on Linux and Ubuntu

npm install -g npm@latest

If you get a permission error (EACCES):

sudo npm install -g npm@latest

A cleaner fix is to set a user-level folder for global packages, or to use nvm (see below), so you do not need sudo.

Update npm on Windows

  1. Open Command Prompt or PowerShell as Administrator.
  2. Check the version:
npm -v
  1. Update:
npm install -g npm@latest
  1. Close the window, open a new one and check again:
npm -v

Update npm on macOS

With npm:

npm install -g npm@latest

With Homebrew (this updates Node.js, which brings its own npm):

brew update
brew upgrade node

Update Node.js and npm together with nvm

nvm (Node Version Manager) lets you install many Node.js versions and switch between them. Each Node.js version comes with a matching npm.

Install the latest LTS version:

nvm install --lts
nvm use --lts

Install the newest version:

nvm install node

Then check:

node -v
npm -v

Install a specific npm version

npm install -g npm@10.8.2

Troubleshooting

  • Command not found after the update: open a new terminal.
  • Permission errors: use nvm, or fix the folder owner of the global directory.
  • Old version still shows: check which npm (Linux/macOS) or where npm (Windows) for a second install.
  • Clear the cache if installs fail: npm cache clean --force.

Quick recap

  • npm install -g npm@latest updates npm.
  • Use nvm to manage Node.js and npm together.