# How to update all global npm packages

> Update all global npm packages with npm update -g, check outdated tools, update one package, and understand which Node installation you are changing.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2026-10-20 | Topics: [Node.js](https://flaviocopes.com/tags/node/) | Canonical: https://flaviocopes.com/npm-update-global/

To update all globally installed npm packages, run:

```sh
npm update -g
```

The `-g` flag means **global**. It targets the command-line tools you installed with `npm install -g`, such as Wrangler or TypeScript.

You can run this command from any directory. It updates the packages in your active npm global installation. Your project's dependencies have their own [update workflow](https://flaviocopes.com/update-npm-dependencies/).

## Check which packages need updating

Before updating, you can see which global packages have newer versions available:

```sh
npm outdated -g
```

The output includes each package's installed version and its available versions. If nothing is outdated, the command prints nothing.

You can also list your global packages, including ones that are already up to date:

```sh
npm list -g --depth=0
```

The `--depth=0` option keeps the list focused on packages you installed directly.

## Update everything, or just one tool

Run `npm update -g` to update all global packages. Then run `npm outdated -g` again to check what remains.

```mermaid
flowchart TD
  accTitle: Update global npm packages
  accDescr: Check outdated global packages, update them, then check the results again.
  A["npm outdated -g: check available updates"] --> B["npm update -g: update global packages"]
  B --> C["npm outdated -g: check the result"]
```

To update a single tool, add its package name. For example, to update a globally installed Wrangler:

```sh
npm update -g wrangler
```

For global packages, npm normally targets the release tagged `latest`. **That can include a major version change**, so read the release notes for tools you rely on before updating everything. If you installed a prerelease newer than `latest`, updating can move it back to that release. The [npm update documentation](https://docs.npmjs.com/cli/v11/commands/npm-update/#updating-globally-installed-packages) explains this behavior.

## Which global installation gets updated?

If you switch Node.js versions with a version manager, you can have different sets of global packages.

Check the global prefix used by your current npm command:

```sh
npm prefix -g
```

The update applies to that installation. After switching Node versions, check its global packages again if a tool appears to be missing or outdated.

For more on how npm stores packages, see [global versus local npm packages](https://flaviocopes.com/npm-packages-local-global/). My free [Node.js course](https://flaviocopes.com/learn/nodejs/) covers packages and modules alongside the rest of the runtime.
