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

NAME

6       npm-update - Update a package
7

SYNOPSIS

9         npm update [-g] [<pkg>...]
10
11         aliases: up, upgrade
12

DESCRIPTION

14       This  command will update all the packages listed to the latest version
15       (specified by the tag config), respecting semver.
16
17       It will also install  missing  packages.  As  with  all  commands  that
18       install  packages, the --dev flag will cause devDependencies to be pro‐
19       cessed as well.
20
21       If the  -g  flag  is  specified,  this  command  will  update  globally
22       installed packages.
23
24       If no package name is specified, all packages in the specified location
25       (global or local) will be updated.
26
27       As of , thenpm updatewill only inspect top-level packages.  Prior  ver‐
28       sions ofnpmwould also recursively inspect all dependencies.  To get the
29       old behavior, usenpm --depth 9999 update`.
30
31       As of , thenpm updatewill changepackage.jsonto save the new version  as
32       the minimum required dependency. To get the old behavior, usenpm update
33       --no-save`.
34

EXAMPLES

36       IMPORTANT VERSION NOTE: these examples assume or later.  For older ver‐
37       sions  ofnpm,  you must specify--depth 0` to get the behavior described
38       below.
39
40       For the examples below, assume that the current package is app  and  it
41       depends  on dependencies, dep1 (dep2, .. etc.).  The published versions
42       of dep1 are:
43
44         {
45           "dist-tags": { "latest": "1.2.2" },
46           "versions": [
47             "1.2.2",
48             "1.2.1",
49             "1.2.0",
50             "1.1.2",
51             "1.1.1",
52             "1.0.0",
53             "0.4.1",
54             "0.4.0",
55             "0.2.0"
56           ]
57         }
58
59   Caret Dependencies
60       If app's package.json contains:
61
62         "dependencies": {
63           "dep1": "^1.1.1"
64         }
65
66       Then  npm  update  will  install  ,  because1.2.2islatestand1.2.2satis‐
67       fies^1.1.1`.
68
69   Tilde Dependencies
70       However, if app's package.json contains:
71
72         "dependencies": {
73           "dep1": "~1.1.1"
74         }
75
76       In this case, running npm update will install .  Even though thelatest‐
77       tag points to1.2.2, this  version  does  not  satisfy~1.1.1,  which  is
78       equivalent  to>=1.1.1 <1.2.0.  So the highest-sorting version that sat‐
79       isfies~1.1.1is used, which is1.1.2`.
80
81   Caret Dependencies below 1.0.0
82       Suppose app has a caret dependency on a version below 1.0.0, for  exam‐
83       ple:
84
85         "dependencies": {
86           "dep1": "^0.2.0"
87         }
88
89       npm  update  will  install  , because there are no other versions which
90       satisfy^0.2.0`.
91
92       If the dependence were on ^0.4.0:
93
94         "dependencies": {
95           "dep1": "^0.4.0"
96         }
97
98       Then npm update will install , because that is the highest-sorting ver‐
99       sion that satisfies^0.4.0(>= 0.4.0 <0.5.0`)
100
101   Updating Globally-Installed Packages
102       npm  update  -g will apply the update action to each globally installed
103       package that is outdated -- that is, has a version  that  is  different
104       from latest.
105
106       NOTE: If a package has been upgraded to a version newer than latest, it
107       will be downgraded.
108

SEE ALSO

110       · npm help install
111
112       · npm help outdated
113
114       · npm help shrinkwrap
115
116       · npm help 7 registry
117
118       · npm help 5 folders
119
120       · npm help ls
121
122
123
124
125
126                                  April 2019                     NPM-UPDATE(1)
Impressum