how to update npm on macOS

This works on my mac.

Based on docs https://docs.npmjs.com/troubleshooting/try-the-latest-stable-version-of-npm :

npm install -g npm@latest

There is a note stated on the docs that depends on your installation method, you might addd some sudo.

Upgrading on *nix (OSX, Linux, etc.)

(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)


npm install -g npm@latest works fine!! and you can also replace the latest for specific versions like npm install -g [email protected]

I hope it will help!!!

Tags:

Macos

Npm