NPM-UPDATE(1)

NAME
npm-update - Update a package

SYNOPSIS

    npm update [-g] [<pkg>...]
    aliases: up, upgrade

DESCRIPTION

This command will update all the packages listed to the latest version (specified by the config), respecting semver.

It will also install missing packages. As with all commands that install packages, the flag will cause to be processed as well.

If the flag is specified, this command will update globally installed packages.

If no package name is specified, all packages in the specified location (global or local) will be updated.

As of npm update npm npm --depth 9999 update`.

EXAMPLES

IMPORTANT VERSION NOTE: these examples assume npm--depth 0` to get the behavior described below.

For the examples below, assume that the current package is and it depends on dependencies, (, .. etc.). The published versions of are:

    {
      "dist-tags": { "latest": "1.2.2" },
      "versions": [
        "1.2.2",
        "1.2.1",
        "1.2.0",
        "1.1.2",
        "1.1.1",
        "1.0.0",
        "0.4.1",
        "0.4.0",
        "0.2.0"
      ]
    }

  Caret Dependencies

If 's contains:

    "dependencies": {
      "dep1": "^1.1.1"
    }

Then will install 1.2.2 latest ^1.1.1`.

  Tilde Dependencies

However, if 's contains:

    "dependencies": {
      "dep1": "~1.1.1"
    }

In this case, running will install latest1.2.2~1.1.1>=1.1.1 <1.2.0~1.1.1 1.1.2`.

  Caret Dependencies below 1.0.0

Suppose has a caret dependency on a version below , for example:

    "dependencies": {
      "dep1": "^0.2.0"
    }

will install ^0.2.0`.

If the dependence were on :

    "dependencies": {
      "dep1": "^0.4.0"
    }

Then will install ^0.4.0>= 0.4.0 <0.5.0`)

  Recording Updates with

When you want to update a package and save the new version as the minimum required dependency in , you can use or . For example if contains:

    "dependencies": {
      "dep1": "^1.1.1"
    }

Then will install latestpackage.json` will be modified:

    "dependencies": {
      "dep1": "^1.2.2"
    }

Note that will only write an updated version to if it installs a new package.

  Updating Globally-Installed Packages

will apply the action to each globally installed package that is -- that is, has a version that is different from .

NOTE: If a package has been upgraded to a version newer than , it will be downgraded.

SEE ALSO

    •   npm help install

    •   npm help outdated

    •   npm help shrinkwrap

    •   npm help 7 registry

    •   npm help 5 folders

    •   npm help ls