codekingpro/portable-devtools
114k
1---
2title: npm-outdated
3section: 1
4description: Check for outdated packages
5---
6
7### Synopsis
8
9```bash
10npm outdated [<package-spec> ...]
11```
12
13### Description
14
15This command will check the registry to see if any (or, specific) installed packages are currently outdated.
16
17By default, only the direct dependencies of the root project and direct dependencies of your configured *workspaces* are shown.
18Use `--all` to find all outdated meta-dependencies as well.
19
20In the output:
21
22* `wanted` is the maximum version of the package that satisfies the semver range specified in `package.json`.
23 If there's no available semver range (i.e. you're running `npm outdated --global`, or the package isn't included in `package.json`), then `wanted` shows the currently-installed version.
24* `latest` is the version of the package tagged as latest in the registry.
25 Running `npm publish` with no special configuration will publish the package with a dist-tag of `latest`.
26 This may or may not be the maximum version of the package, or the most-recently published version of the package, depending on how the package's developer manages the latest [dist-tag](/commands/npm-dist-tag).
27* `location` is where in the physical tree the package is located.
28* `depended by` shows which package depends on the displayed dependency
29* `package type` (when using `--long` / `-l`) tells you whether this package is a `dependency` or a dev/peer/optional dependency.
30 Packages not included in `package.json` are always marked `dependencies`.
31* `homepage` (when using `--long` / `-l`) is the `homepage` value contained in the package's packument
32* `depended by location` (when using `--long` / `-l`) shows location of the package that depends on the displayed dependency
33* Red means there's a newer version matching your semver requirements, so you should update now.
34* Yellow indicates that there's a newer version _above_ your semver requirements (usually new major, or new 0.x minor) so proceed with caution.
35
36### An example
37
38```bash
39$ npm outdated
40Package Current Wanted Latest Location Depended by
41glob 5.0.15 5.0.15 6.0.1 node_modules/glob dependent-package-name
42nothingness 0.0.3 git git node_modules/nothingness dependent-package-name
43npm 3.5.1 3.5.2 3.5.1 node_modules/npm dependent-package-name
44local-dev 0.0.3 linked linked local-dev dependent-package-name
45once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-package-name
46```
47
48With these `dependencies`:
49```json
50{
51 "glob": "^5.0.15",
52 "nothingness": "github:othiym23/nothingness#master",
53 "npm": "^3.5.1",
54 "once": "^1.3.1"
55}
56```
57
58A few things to note:
59
60* `glob` requires `^5`, which prevents npm from installing `glob@6`, which is outside the semver range.
61* Git dependencies will always be reinstalled, because of how they're specified.
62 The installed committish might satisfy the dependency specifier (if it's something immutable, like a commit SHA), or it might not, so `npm outdated` and `npm update` have to fetch Git repos to check.
63 This is why currently doing a reinstall of a Git dependency always forces a new clone and install.
64* `npm@3.5.2` is marked as "wanted", but "latest" is `npm@3.5.1` because npm uses dist-tags to manage its `latest` and `next` release channels.
65 `npm update` will install the _newest_ version, but `npm install npm` (with no semver range) will install whatever's tagged as `latest`.
66* `once` is just plain out of date.
67 Reinstalling `node_modules` from scratch or running `npm update` will bring it up to spec.
68
69### Configuration
70
71#### `all`
72
73* Default: false
74* Type: Boolean
75
76When running `npm outdated` and `npm ls`, setting `--all` will show all
77outdated or installed packages, rather than only those directly depended
78upon by the current project.
79
80
81
82#### `json`
83
84* Default: false
85* Type: Boolean
86
87Whether or not to output JSON data, rather than the normal output.
88
89* In `npm pkg set` it enables parsing set values with JSON.parse() before
90 saving them to your `package.json`.
91
92Not supported by all npm commands.
93
94
95
96#### `long`
97
98* Default: false
99* Type: Boolean
100
101Show extended information in `ls`, `search`, and `help-search`.
102
103
104
105#### `parseable`
106
107* Default: false
108* Type: Boolean
109
110Output parseable results from commands that write to standard output. For
111`npm search`, this will be tab-separated table format.
112
113
114
115#### `global`
116
117* Default: false
118* Type: Boolean
119
120Operates in "global" mode, so that packages are installed into the `prefix`
121folder instead of the current working directory. See
122[folders](/configuring-npm/folders) for more on the differences in behavior.
123
124* packages are installed into the `{prefix}/lib/node_modules` folder, instead
125 of the current working directory.
126* bin files are linked to `{prefix}/bin`
127* man pages are linked to `{prefix}/share/man`
128
129
130
131#### `workspace`
132
133* Default:
134* Type: String (can be set multiple times)
135
136Enable running a command in the context of the configured workspaces of the
137current project while filtering by running only the workspaces defined by
138this configuration option.
139
140Valid values for the `workspace` config are either:
141
142* Workspace names
143* Path to a workspace directory
144* Path to a parent workspace directory (will result in selecting all
145 workspaces within that folder)
146
147When set for the `npm init` command, this may be set to the folder of a
148workspace which does not yet exist, to create the folder and set it up as a
149brand new workspace within the project.
150
151This value is not exported to the environment for child processes.
152
153#### `before`
154
155* Default: null
156* Type: null or Date
157
158If passed to `npm install`, will rebuild the npm tree such that only
159versions that were available **on or before** the given date are installed.
160If there are no versions available for the current set of dependencies, the
161command will error.
162
163If the requested version is a `dist-tag` and the given tag does not pass the
164`--before` filter, the most recent version less than or equal to that tag
165will be used. For example, `foo@latest` might install `foo@1.2` even though
166`latest` is `2.0`.
167
168This config cannot be used with: `min-release-age`
169
170#### `min-release-age`
171
172* Default: null
173* Type: null or Number
174
175If set, npm will build the npm tree such that only versions that were
176available more than the given number of days ago will be installed. If there
177are no versions available for the current set of dependencies, the command
178will error.
179
180This flag is a complement to `before`, which accepts an exact date instead
181of a relative number of days.
182
183This config cannot be used with: `before`
184
185This value is not exported to the environment for child processes.
186
187### See Also
188
189* [package spec](/using-npm/package-spec)
190* [npm update](/commands/npm-update)
191* [npm dist-tag](/commands/npm-dist-tag)
192* [npm registry](/using-npm/registry)
193* [npm folders](/configuring-npm/folders)
194* [npm workspaces](/using-npm/workspaces)
195 