How to update globally installed npm packages

To automatically update all global packages to the 'Latest' version:

npx npm-check --global --update-all

That will update all global packages to the 'Latest' version. More information is available about npm-check, including the ability to perform an interactive update, exclude packages, etc.


To instead only update global packages to the 'Wanted' version shown by npm outdated --global (as globally installed packages are treated as if they are installed with a caret semver range specified):

npm update -g

Lastly, if you want to update (install) a package to a version other than 'Latest' or 'Wanted':

npm install --global <pkg>@<version>

If you want to update all global packages

npm update -g

If you want to update specific global package

npm update -g <package_name>

To add to Mohit's answer, if you're using NPM 2.6 or less, there are a couple scripts that are handy in handling the update in that scenario: https://gist.github.com/othiym23/4ac31155da23962afd0e.

You'll need to create the two files described, and run them from the command prompt. This will update all the packages. For a selective update, scroll down the page at the above link to Dylang's comment from October 20, 2014. The comment below from Nov 6, 2014 will hook you up with scripts for a Windows environment.

Looking at long term maintenance, your best solution might be to update NPM first by running:

npm install npm@latest -g

A fairly comprehensive documentation of the processes can be found at https://docs.npmjs.com/updating-packages-downloaded-from-the-registry