11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: npm-outdated 31cb0ef41Sopenharmony_cisection: 1 41cb0ef41Sopenharmony_cidescription: Check for outdated packages 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci```bash 101cb0ef41Sopenharmony_cinpm outdated [<package-spec> ...] 111cb0ef41Sopenharmony_ci``` 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci### Description 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciThis command will check the registry to see if any (or, specific) installed 161cb0ef41Sopenharmony_cipackages are currently outdated. 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciBy default, only the direct dependencies of the root project and direct 191cb0ef41Sopenharmony_cidependencies of your configured *workspaces* are shown. 201cb0ef41Sopenharmony_ciUse `--all` to find all outdated meta-dependencies as well. 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciIn the output: 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci* `wanted` is the maximum version of the package that satisfies the semver 251cb0ef41Sopenharmony_ci range specified in `package.json`. If there's no available semver range 261cb0ef41Sopenharmony_ci (i.e. you're running `npm outdated --global`, or the package isn't 271cb0ef41Sopenharmony_ci included in `package.json`), then `wanted` shows the currently-installed 281cb0ef41Sopenharmony_ci version. 291cb0ef41Sopenharmony_ci* `latest` is the version of the package tagged as latest in the registry. 301cb0ef41Sopenharmony_ci Running `npm publish` with no special configuration will publish the 311cb0ef41Sopenharmony_ci package with a dist-tag of `latest`. This may or may not be the maximum 321cb0ef41Sopenharmony_ci version of the package, or the most-recently published version of the 331cb0ef41Sopenharmony_ci package, depending on how the package's developer manages the latest 341cb0ef41Sopenharmony_ci [dist-tag](/commands/npm-dist-tag). 351cb0ef41Sopenharmony_ci* `location` is where in the physical tree the package is located. 361cb0ef41Sopenharmony_ci* `depended by` shows which package depends on the displayed dependency 371cb0ef41Sopenharmony_ci* `package type` (when using `--long` / `-l`) tells you whether this 381cb0ef41Sopenharmony_ci package is a `dependency` or a dev/peer/optional dependency. Packages not 391cb0ef41Sopenharmony_ci included in `package.json` are always marked `dependencies`. 401cb0ef41Sopenharmony_ci* `homepage` (when using `--long` / `-l`) is the `homepage` value contained 411cb0ef41Sopenharmony_ci in the package's packument 421cb0ef41Sopenharmony_ci* Red means there's a newer version matching your semver requirements, so 431cb0ef41Sopenharmony_ci you should update now. 441cb0ef41Sopenharmony_ci* Yellow indicates that there's a newer version _above_ your semver 451cb0ef41Sopenharmony_ci requirements (usually new major, or new 0.x minor) so proceed with 461cb0ef41Sopenharmony_ci caution. 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci### An example 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci```bash 511cb0ef41Sopenharmony_ci$ npm outdated 521cb0ef41Sopenharmony_ciPackage Current Wanted Latest Location Depended by 531cb0ef41Sopenharmony_ciglob 5.0.15 5.0.15 6.0.1 node_modules/glob dependent-package-name 541cb0ef41Sopenharmony_cinothingness 0.0.3 git git node_modules/nothingness dependent-package-name 551cb0ef41Sopenharmony_cinpm 3.5.1 3.5.2 3.5.1 node_modules/npm dependent-package-name 561cb0ef41Sopenharmony_cilocal-dev 0.0.3 linked linked local-dev dependent-package-name 571cb0ef41Sopenharmony_cionce 1.3.2 1.3.3 1.3.3 node_modules/once dependent-package-name 581cb0ef41Sopenharmony_ci``` 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ciWith these `dependencies`: 611cb0ef41Sopenharmony_ci```json 621cb0ef41Sopenharmony_ci{ 631cb0ef41Sopenharmony_ci "glob": "^5.0.15", 641cb0ef41Sopenharmony_ci "nothingness": "github:othiym23/nothingness#master", 651cb0ef41Sopenharmony_ci "npm": "^3.5.1", 661cb0ef41Sopenharmony_ci "once": "^1.3.1" 671cb0ef41Sopenharmony_ci} 681cb0ef41Sopenharmony_ci``` 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ciA few things to note: 711cb0ef41Sopenharmony_ci 721cb0ef41Sopenharmony_ci* `glob` requires `^5`, which prevents npm from installing `glob@6`, which 731cb0ef41Sopenharmony_ci is outside the semver range. 741cb0ef41Sopenharmony_ci* Git dependencies will always be reinstalled, because of how they're 751cb0ef41Sopenharmony_ci specified. The installed committish might satisfy the dependency 761cb0ef41Sopenharmony_ci specifier (if it's something immutable, like a commit SHA), or it might 771cb0ef41Sopenharmony_ci not, so `npm outdated` and `npm update` have to fetch Git repos to check. 781cb0ef41Sopenharmony_ci This is why currently doing a reinstall of a Git dependency always forces 791cb0ef41Sopenharmony_ci a new clone and install. 801cb0ef41Sopenharmony_ci* `npm@3.5.2` is marked as "wanted", but "latest" is `npm@3.5.1` because 811cb0ef41Sopenharmony_ci npm uses dist-tags to manage its `latest` and `next` release channels. 821cb0ef41Sopenharmony_ci `npm update` will install the _newest_ version, but `npm install npm` 831cb0ef41Sopenharmony_ci (with no semver range) will install whatever's tagged as `latest`. 841cb0ef41Sopenharmony_ci* `once` is just plain out of date. Reinstalling `node_modules` from 851cb0ef41Sopenharmony_ci scratch or running `npm update` will bring it up to spec. 861cb0ef41Sopenharmony_ci 871cb0ef41Sopenharmony_ci### Configuration 881cb0ef41Sopenharmony_ci 891cb0ef41Sopenharmony_ci#### `all` 901cb0ef41Sopenharmony_ci 911cb0ef41Sopenharmony_ci* Default: false 921cb0ef41Sopenharmony_ci* Type: Boolean 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_ciWhen running `npm outdated` and `npm ls`, setting `--all` will show all 951cb0ef41Sopenharmony_cioutdated or installed packages, rather than only those directly depended 961cb0ef41Sopenharmony_ciupon by the current project. 971cb0ef41Sopenharmony_ci 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci 1001cb0ef41Sopenharmony_ci#### `json` 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ci* Default: false 1031cb0ef41Sopenharmony_ci* Type: Boolean 1041cb0ef41Sopenharmony_ci 1051cb0ef41Sopenharmony_ciWhether or not to output JSON data, rather than the normal output. 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci* In `npm pkg set` it enables parsing set values with JSON.parse() before 1081cb0ef41Sopenharmony_ci saving them to your `package.json`. 1091cb0ef41Sopenharmony_ci 1101cb0ef41Sopenharmony_ciNot supported by all npm commands. 1111cb0ef41Sopenharmony_ci 1121cb0ef41Sopenharmony_ci 1131cb0ef41Sopenharmony_ci 1141cb0ef41Sopenharmony_ci#### `long` 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_ci* Default: false 1171cb0ef41Sopenharmony_ci* Type: Boolean 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_ciShow extended information in `ls`, `search`, and `help-search`. 1201cb0ef41Sopenharmony_ci 1211cb0ef41Sopenharmony_ci 1221cb0ef41Sopenharmony_ci 1231cb0ef41Sopenharmony_ci#### `parseable` 1241cb0ef41Sopenharmony_ci 1251cb0ef41Sopenharmony_ci* Default: false 1261cb0ef41Sopenharmony_ci* Type: Boolean 1271cb0ef41Sopenharmony_ci 1281cb0ef41Sopenharmony_ciOutput parseable results from commands that write to standard output. For 1291cb0ef41Sopenharmony_ci`npm search`, this will be tab-separated table format. 1301cb0ef41Sopenharmony_ci 1311cb0ef41Sopenharmony_ci 1321cb0ef41Sopenharmony_ci 1331cb0ef41Sopenharmony_ci#### `global` 1341cb0ef41Sopenharmony_ci 1351cb0ef41Sopenharmony_ci* Default: false 1361cb0ef41Sopenharmony_ci* Type: Boolean 1371cb0ef41Sopenharmony_ci 1381cb0ef41Sopenharmony_ciOperates in "global" mode, so that packages are installed into the `prefix` 1391cb0ef41Sopenharmony_cifolder instead of the current working directory. See 1401cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior. 1411cb0ef41Sopenharmony_ci 1421cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead 1431cb0ef41Sopenharmony_ci of the current working directory. 1441cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin` 1451cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man` 1461cb0ef41Sopenharmony_ci 1471cb0ef41Sopenharmony_ci 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_ci#### `workspace` 1501cb0ef41Sopenharmony_ci 1511cb0ef41Sopenharmony_ci* Default: 1521cb0ef41Sopenharmony_ci* Type: String (can be set multiple times) 1531cb0ef41Sopenharmony_ci 1541cb0ef41Sopenharmony_ciEnable running a command in the context of the configured workspaces of the 1551cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by 1561cb0ef41Sopenharmony_cithis configuration option. 1571cb0ef41Sopenharmony_ci 1581cb0ef41Sopenharmony_ciValid values for the `workspace` config are either: 1591cb0ef41Sopenharmony_ci 1601cb0ef41Sopenharmony_ci* Workspace names 1611cb0ef41Sopenharmony_ci* Path to a workspace directory 1621cb0ef41Sopenharmony_ci* Path to a parent workspace directory (will result in selecting all 1631cb0ef41Sopenharmony_ci workspaces within that folder) 1641cb0ef41Sopenharmony_ci 1651cb0ef41Sopenharmony_ciWhen set for the `npm init` command, this may be set to the folder of a 1661cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a 1671cb0ef41Sopenharmony_cibrand new workspace within the project. 1681cb0ef41Sopenharmony_ci 1691cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes. 1701cb0ef41Sopenharmony_ci 1711cb0ef41Sopenharmony_ci### See Also 1721cb0ef41Sopenharmony_ci 1731cb0ef41Sopenharmony_ci* [package spec](/using-npm/package-spec) 1741cb0ef41Sopenharmony_ci* [npm update](/commands/npm-update) 1751cb0ef41Sopenharmony_ci* [npm dist-tag](/commands/npm-dist-tag) 1761cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry) 1771cb0ef41Sopenharmony_ci* [npm folders](/configuring-npm/folders) 1781cb0ef41Sopenharmony_ci* [npm workspaces](/using-npm/workspaces) 179