1NPM-UPDATE(1)                                                    NPM-UPDATE(1)
2
3
4

NAME

6       npm-update - Update packages
7
8   Synopsis
9         npm update [-g] [<pkg>...]
10
11         aliases: up, upgrade
12
13   Description
14       This  command will update all the packages listed to the latest version
15       (specified by the tag config), respecting  the  semver  constraints  of
16       both  your  package and its dependencies (if they also require the same
17       package).
18
19       It will also install missing packages.
20
21       If the -g flag is specified, this  command  will  update  globally  in‐
22       stalled packages.
23
24       If no package name is specified, all packages in the specified location
25       (global or local) will be updated.
26
27   Example
28       For the examples below, assume that the current package is app  and  it
29       depends  on dependencies, dep1 (dep2, .. etc.).  The published versions
30       of dep1 are:
31
32         {
33           "dist-tags": { "latest": "1.2.2" },
34           "versions": [
35             "1.2.2",
36             "1.2.1",
37             "1.2.0",
38             "1.1.2",
39             "1.1.1",
40             "1.0.0",
41             "0.4.1",
42             "0.4.0",
43             "0.2.0"
44           ]
45         }
46
47   Caret Dependencies
48       If app's package.json contains:
49
50         "dependencies": {
51           "dep1": "^1.1.1"
52         }
53
54       Then npm update will install dep1@1.2.2, because 1.2.2  is  latest  and
55       1.2.2 satisfies ^1.1.1.
56
57   Tilde Dependencies
58       However, if app's package.json contains:
59
60         "dependencies": {
61           "dep1": "~1.1.1"
62         }
63
64       In  this case, running npm update will install dep1@1.1.2.  Even though
65       the latest tag points to 1.2.2, this version  do  not  satisfy  ~1.1.1,
66       which  is equivalent to >=1.1.1 <1.2.0.  So the highest-sorting version
67       that satisfies ~1.1.1 is used, which is 1.1.2.
68
69   Caret Dependencies below 1.0.0
70       Suppose app has a caret dependency on a version below 1.0.0, for  exam‐
71       ple:
72
73         "dependencies": {
74           "dep1": "^0.2.0"
75         }
76
77       npm update will install dep1@0.2.0, because there are no other versions
78       which satisfy ^0.2.0.
79
80       If the dependence were on ^0.4.0:
81
82         "dependencies": {
83           "dep1": "^0.4.0"
84         }
85
86       Then npm update will install dep1@0.4.1,  because  that  is  the  high‐
87       est-sorting version that satisfies ^0.4.0 (>= 0.4.0 <0.5.0)
88
89   Subdependencies
90       Suppose your app now also has a dependency on dep2
91
92         {
93           "name": "my-app",
94           "dependencies": {
95               "dep1": "^1.0.0",
96               "dep2": "1.0.0"
97           }
98         }
99
100       and dep2 itself depends on this limited range of dep1
101
102         {
103         "name": "dep2",
104           "dependencies": {
105             "dep1": "~1.1.1"
106           }
107         }
108
109       Then  npm  update  will  install dep1@1.1.2 because that is the highest
110       version that dep2 allows.  npm will prioritize having a single  version
111       of  dep1 in your tree rather than two when that single version can sat‐
112       isfy the semver requirements of multiple dependencies in your tree.  In
113       this  case  if  you really did need your package to use a newer version
114       you would need to use npm install.
115
116   Updating Globally-Installed Packages
117       npm update -g will apply the update action to each  globally  installed
118       package  that  is  outdated -- that is, has a version that is different
119       from wanted.
120
121       Note: Globally installed packages are treated as if they are  installed
122       with  a  caret  semver  range specified. So if you require to update to
123       latest you may need to run npm install -g [<pkg>...]
124
125       NOTE: If a package has been upgraded to a version newer than latest, it
126       will be downgraded.
127
128   Configuration
129       <!--  AUTOGENERATED  CONFIG  DESCRIPTIONS  START --> <!-- automatically
130       generated, do not edit manually --> <!--  see  lib/utils/config/defini‐
131       tions.js -->
132
133   global
134       • Default: false
135
136       • Type: Boolean
137
138
139       Operates in "global" mode, so that packages are installed into the pre‐
140       fix folder instead of the current working directory. See npm help fold‐
141       ers for more on the differences in behavior.
142
143       • packages are installed into the {prefix}/lib/node_modules folder, in‐
144         stead of the current working directory.
145
146       • bin files are linked to {prefix}/bin
147
148       • man pages are linked to {prefix}/share/man
149
150       <!-- automatically  generated,  do  not  edit  manually  -->  <!--  see
151       lib/utils/config/definitions.js -->
152
153
154   global-style
155       • Default: false
156
157       • Type: Boolean
158
159
160       Causes  npm  to install the package into your local node_modules folder
161       with the same layout it uses with the global node_modules folder.  Only
162       your  direct dependencies will show in node_modules and everything they
163       depend on will be flattened in their node_modules folders.  This  obvi‐
164       ously  will  eliminate  some  deduping.  If  used with legacy-bundling,
165       legacy-bundling will be preferred.  <!--  automatically  generated,  do
166       not edit manually --> <!-- see lib/utils/config/definitions.js -->
167
168
169   legacy-bundling
170       • Default: false
171
172       • Type: Boolean
173
174
175       Causes  npm  to  install the package such that versions of npm prior to
176       1.4, such as the one included with node 0.8, can install  the  package.
177       This  eliminates all automatic deduping. If used with global-style this
178       option will be preferred.  <!-- automatically generated,  do  not  edit
179       manually --> <!-- see lib/utils/config/definitions.js -->
180
181
182   strict-peer-deps
183       • Default: false
184
185       • Type: Boolean
186
187
188       If set to true, and --legacy-peer-deps is not set, then any conflicting
189       peerDependencies will be treated as an install  failure,  even  if  npm
190       could reasonably guess the appropriate resolution based on non-peer de‐
191       pendency relationships.
192
193       By default, conflicting peerDependencies deep in the  dependency  graph
194       will  be  resolved using the nearest non-peer dependency specification,
195       even if doing so will result in some packages receiving a  peer  depen‐
196       dency outside the range set in their package's peerDependencies object.
197
198       When  such  and override is performed, a warning is printed, explaining
199       the conflict and the packages involved. If --strict-peer-deps  is  set,
200       then  this  warning is treated as a failure.  <!-- automatically gener‐
201       ated, do not edit manually --> <!-- see lib/utils/config/definitions.js
202       -->
203
204
205   package-lock
206       • Default: true
207
208       • Type: Boolean
209
210
211       If  set  to false, then ignore package-lock.json files when installing.
212       This will also prevent writing package-lock.json if save is true.
213
214       When package package-locks are disabled, automatic pruning of  extrane‐
215       ous  modules  will  also be disabled. To remove extraneous modules with
216       package-locks disabled use npm prune.  <!-- automatically generated, do
217       not edit manually --> <!-- see lib/utils/config/definitions.js -->
218
219
220   omit
221       • Default:  'dev'  if the NODE_ENV environment variable is set to 'pro‐
222         duction', otherwise empty.
223
224       • Type: "dev", "optional", or "peer" (can be set multiple times)
225
226
227       Dependency types to omit from the installation tree on disk.
228
229       Note that these dependencies are still resolved and added to the  pack‐
230       age-lock.json or npm-shrinkwrap.json file. They are just not physically
231       installed on disk.
232
233       If a package type appears in both the --include and --omit lists,  then
234       it will be included.
235
236       If  the  resulting omit list includes 'dev', then the NODE_ENV environ‐
237       ment variable will be set to 'production' for  all  lifecycle  scripts.
238       <!--  automatically  generated,  do  not  edit  manually  -->  <!-- see
239       lib/utils/config/definitions.js -->
240
241
242   ignore-scripts
243       • Default: false
244
245       • Type: Boolean
246
247
248       If true, npm does not run scripts specified in package.json files.
249
250       Note that commands explicitly intended to run a particular script, such
251       as  npm start, npm stop, npm restart, npm test, and npm run-script will
252       still run their intended script if ignore-scripts is set, but they will
253       not run any pre- or post-scripts.  <!-- automatically generated, do not
254       edit manually --> <!-- see lib/utils/config/definitions.js -->
255
256
257   audit
258       • Default: true
259
260       • Type: Boolean
261
262
263       When "true" submit audit reports alongside the current npm  command  to
264       the  default registry and all registries configured for scopes. See the
265       documentation for npm help audit for  details  on  what  is  submitted.
266       <!--  automatically  generated,  do  not  edit  manually  -->  <!-- see
267       lib/utils/config/definitions.js -->
268
269
270   bin-links
271       • Default: true
272
273       • Type: Boolean
274
275
276       Tells npm to create symlinks (or .cmd shims on Windows) for package ex‐
277       ecutables.
278
279       Set  to  false  to have it not do this. This can be used to work around
280       the fact that some file systems don't support symlinks, even on  osten‐
281       sibly Unix systems.  <!-- automatically generated, do not edit manually
282       --> <!-- see lib/utils/config/definitions.js -->
283
284
285   fund
286       • Default: true
287
288       • Type: Boolean
289
290
291       When "true" displays the message at the end of  each  npm  install  ac‐
292       knowledging  the  number  of  dependencies looking for funding. See npm
293       help npm fund for details.  <!-- automatically generated, do  not  edit
294       manually --> <!-- see lib/utils/config/definitions.js -->
295
296
297   dry-run
298       • Default: false
299
300       • Type: Boolean
301
302
303       Indicates  that  you  don't  want  npm  to make any changes and that it
304       should only report what it would have done. This can be passed into any
305       of  the  commands that modify your local installation, eg, install, up‐
306       date, dedupe, uninstall, as well as pack and publish.
307
308       Note: This is  NOT  honored  by  other  network  related  commands,  eg
309       dist-tags, owner, etc.  <!-- automatically generated, do not edit manu‐
310       ally --> <!-- see lib/utils/config/definitions.js -->
311
312
313   workspace
314       • Default:
315
316       • Type: String (can be set multiple times)
317
318
319       Enable running a command in the context of the configured workspaces of
320       the  current project while filtering by running only the workspaces de‐
321       fined by this configuration option.
322
323       Valid values for the workspace config are either:
324
325       • Workspace names
326
327       • Path to a workspace directory
328
329       • Path to a parent workspace directory (will result to selecting all of
330         the nested workspaces)
331
332
333       When  set  for the npm init command, this may be set to the folder of a
334       workspace which does not yet exist, to create the folder and set it  up
335       as a brand new workspace within the project.
336
337       This  value  is  not  exported  to the environment for child processes.
338       <!-- automatically  generated,  do  not  edit  manually  -->  <!--  see
339       lib/utils/config/definitions.js -->
340
341
342   workspaces
343       • Default: false
344
345       • Type: Boolean
346
347
348       Enable  running  a  command  in  the  context  of  all  the  configured
349       workspaces.
350
351       This value is not exported to  the  environment  for  child  processes.
352       <!--  automatically  generated,  do  not  edit  manually  -->  <!-- see
353       lib/utils/config/definitions.js -->
354
355       <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
356
357
358   See Also
359       • npm help install
360
361       • npm help outdated
362
363       • npm help shrinkwrap
364
365       • npm help registry
366
367       • npm help folders
368
369       • npm help ls
370
371
372
373
374                                 October 2021                    NPM-UPDATE(1)
Impressum