summaryrefslogtreecommitdiff
path: root/deps/npm/man/man1/npm-update.1
blob: 6486b8aef073b43091af090be3bfbe7f06883a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.TH "NPM\-UPDATE" "1" "January 2019" "" ""
.SH "NAME"
\fBnpm-update\fR \- Update a package
.SH SYNOPSIS
.P
.RS 2
.nf
npm update [\-g] [<pkg>\.\.\.]

aliases: up, upgrade
.fi
.RE
.SH DESCRIPTION
.P
This command will update all the packages listed to the latest version
(specified by the \fBtag\fP config), respecting semver\.
.P
It will also install missing packages\. As with all commands that install
packages, the \fB\-\-dev\fP flag will cause \fBdevDependencies\fP to be processed
as well\.
.P
If the \fB\-g\fP flag is specified, this command will update globally installed
packages\.
.P
If no package name is specified, all packages in the specified location (global
or local) will be updated\.
.P
As of \fB, the\fPnpm update\fBwill only inspect top\-level packages\.
Prior versions of\fPnpm\fBwould also recursively inspect all dependencies\.
To get the old behavior, use\fPnpm \-\-depth 9999 update`\.
.P
As of \fB, the\fPnpm update\fBwill change\fPpackage\.json\fBto save the
new version as the minimum required dependency\. To get the old behavior,
use\fPnpm update \-\-no\-save`\.
.SH EXAMPLES
.P
IMPORTANT VERSION NOTE: these examples assume \fBor later\.  For
older versions of\fPnpm\fB, you must specify\fP\-\-depth 0` to get the behavior
described below\.
.P
For the examples below, assume that the current package is \fBapp\fP and it depends
on dependencies, \fBdep1\fP (\fBdep2\fP, \.\. etc\.)\.  The published versions of \fBdep1\fP are:
.P
.RS 2
.nf
{
  "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"
  ]
}
.fi
.RE
.SS Caret Dependencies
.P
If \fBapp\fP\|'s \fBpackage\.json\fP contains:
.P
.RS 2
.nf
"dependencies": {
  "dep1": "^1\.1\.1"
}
.fi
.RE
.P
Then \fBnpm update\fP will install \fB, because\fP1\.2\.2\fBis\fPlatest\fBand\fP1\.2\.2\fBsatisfies\fP^1\.1\.1`\.
.SS Tilde Dependencies
.P
However, if \fBapp\fP\|'s \fBpackage\.json\fP contains:
.P
.RS 2
.nf
"dependencies": {
  "dep1": "~1\.1\.1"
}
.fi
.RE
.P
In this case, running \fBnpm update\fP will install \fB\|\.  Even though the\fPlatest\fBtag points to\fP1\.2\.2\fB, this version does not satisfy\fP~1\.1\.1\fB, which is equivalent
to\fP>=1\.1\.1 <1\.2\.0\fB\|\.  So the highest\-sorting version that satisfies\fP~1\.1\.1\fBis used,
which is\fP1\.1\.2`\.
.SS Caret Dependencies below 1\.0\.0
.P
Suppose \fBapp\fP has a caret dependency on a version below \fB1\.0\.0\fP, for example:
.P
.RS 2
.nf
"dependencies": {
  "dep1": "^0\.2\.0"
}
.fi
.RE
.P
\fBnpm update\fP will install \fB, because there are no other
versions which satisfy\fP^0\.2\.0`\.
.P
If the dependence were on \fB^0\.4\.0\fP:
.P
.RS 2
.nf
"dependencies": {
  "dep1": "^0\.4\.0"
}
.fi
.RE
.P
Then \fBnpm update\fP will install \fB, because that is the highest\-sorting
version that satisfies\fP^0\.4\.0\fB(\fP>= 0\.4\.0 <0\.5\.0`)
.SS Updating Globally\-Installed Packages
.P
\fBnpm update \-g\fP will apply the \fBupdate\fP action to each globally installed
package that is \fBoutdated\fP \-\- that is, has a version that is different from
\fBlatest\fP\|\.
.P
NOTE: If a package has been upgraded to a version newer than \fBlatest\fP, it will
be \fIdowngraded\fR\|\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
npm help install
.IP \(bu 2
npm help outdated
.IP \(bu 2
npm help shrinkwrap
.IP \(bu 2
npm help 7 registry
.IP \(bu 2
npm help 5 folders
.IP \(bu 2
npm help ls

.RE