2021-05-10 17:31:02 -04:00
|
|
|
.TH "NPM\-UPDATE" "1" "May 2021" "" ""
|
2011-11-26 09:21:03 -08:00
|
|
|
.SH "NAME"
|
2021-01-28 17:38:39 -05:00
|
|
|
\fBnpm-update\fR \- Update packages
|
2019-11-05 14:55:08 -05:00
|
|
|
.SS Synopsis
|
2014-09-24 14:41:07 -07:00
|
|
|
.P
|
|
|
|
.RS 2
|
2014-11-04 15:08:12 -08:00
|
|
|
.nf
|
2015-10-09 23:13:57 -07:00
|
|
|
npm update [\-g] [<pkg>\.\.\.]
|
2016-03-29 23:30:51 -07:00
|
|
|
|
|
|
|
aliases: up, upgrade
|
2014-11-04 15:08:12 -08:00
|
|
|
.fi
|
2014-09-24 14:41:07 -07:00
|
|
|
.RE
|
2019-11-05 14:55:08 -05:00
|
|
|
.SS Description
|
2014-09-24 14:41:07 -07:00
|
|
|
.P
|
2011-11-26 09:21:03 -08:00
|
|
|
This command will update all the packages listed to the latest version
|
2015-07-24 15:09:52 -07:00
|
|
|
(specified by the \fBtag\fP config), respecting semver\.
|
2011-11-26 09:21:03 -08:00
|
|
|
.P
|
2015-01-17 00:50:09 -08:00
|
|
|
It will also install missing packages\. As with all commands that install
|
2015-07-24 15:09:52 -07:00
|
|
|
packages, the \fB\-\-dev\fP flag will cause \fBdevDependencies\fP to be processed
|
2015-01-17 00:50:09 -08:00
|
|
|
as well\.
|
2013-02-15 10:49:16 -08:00
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
If the \fB\-g\fP flag is specified, this command will update globally installed
|
2014-09-24 14:41:07 -07:00
|
|
|
packages\.
|
|
|
|
.P
|
|
|
|
If no package name is specified, all packages in the specified location (global
|
|
|
|
or local) will be updated\.
|
2019-11-05 14:55:08 -05:00
|
|
|
.SS Example
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
For the examples below, assume that the current package is \fBapp\fP and it depends
|
2021-01-28 17:38:39 -05:00
|
|
|
on dependencies, \fBdep1\fP (\fBdep2\fP, \.\. etc\.)\. The published versions of \fBdep1\fP
|
|
|
|
are:
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
|
|
|
.RS 2
|
|
|
|
.nf
|
|
|
|
{
|
2016-02-22 11:59:14 -08:00
|
|
|
"dist\-tags": { "latest": "1\.2\.2" },
|
2016-03-29 23:30:51 -07:00
|
|
|
"versions": [
|
2016-02-22 11:59:14 -08:00
|
|
|
"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"
|
2016-03-29 23:30:51 -07:00
|
|
|
]
|
2015-03-06 02:57:32 -06:00
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.SS Caret Dependencies
|
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
If \fBapp\fP\|'s \fBpackage\.json\fP contains:
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
|
|
|
.RS 2
|
|
|
|
.nf
|
2016-02-22 11:59:14 -08:00
|
|
|
"dependencies": {
|
|
|
|
"dep1": "^1\.1\.1"
|
2015-03-06 02:57:32 -06:00
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.P
|
2019-07-24 23:00:03 -07:00
|
|
|
Then \fBnpm update\fP will install \fBdep1@1\.2\.2\fP, because \fB1\.2\.2\fP is \fBlatest\fP and
|
|
|
|
\fB1\.2\.2\fP satisfies \fB^1\.1\.1\fP\|\.
|
2015-03-06 02:57:32 -06:00
|
|
|
.SS Tilde Dependencies
|
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
However, if \fBapp\fP\|'s \fBpackage\.json\fP contains:
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
|
|
|
.RS 2
|
|
|
|
.nf
|
2016-02-22 11:59:14 -08:00
|
|
|
"dependencies": {
|
|
|
|
"dep1": "~1\.1\.1"
|
2015-03-06 02:57:32 -06:00
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.P
|
2021-01-28 17:38:39 -05:00
|
|
|
In this case, running \fBnpm update\fP will install \fBdep1@1\.1\.2\fP\|\. Even though the
|
|
|
|
\fBlatest\fP tag points to \fB1\.2\.2\fP, this version do not satisfy \fB~1\.1\.1\fP, which is
|
|
|
|
equivalent to \fB>=1\.1\.1 <1\.2\.0\fP\|\. So the highest\-sorting version that satisfies
|
|
|
|
\fB~1\.1\.1\fP is used, which is \fB1\.1\.2\fP\|\.
|
2015-03-06 02:57:32 -06:00
|
|
|
.SS Caret Dependencies below 1\.0\.0
|
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
Suppose \fBapp\fP has a caret dependency on a version below \fB1\.0\.0\fP, for example:
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
|
|
|
.RS 2
|
|
|
|
.nf
|
2016-02-22 11:59:14 -08:00
|
|
|
"dependencies": {
|
|
|
|
"dep1": "^0\.2\.0"
|
2015-03-06 02:57:32 -06:00
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.P
|
2019-07-24 23:00:03 -07:00
|
|
|
\fBnpm update\fP will install \fBdep1@0\.2\.0\fP, because there are no other
|
|
|
|
versions which satisfy \fB^0\.2\.0\fP\|\.
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
If the dependence were on \fB^0\.4\.0\fP:
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
|
|
|
.RS 2
|
|
|
|
.nf
|
2016-02-22 11:59:14 -08:00
|
|
|
"dependencies": {
|
|
|
|
"dep1": "^0\.4\.0"
|
2015-03-06 02:57:32 -06:00
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.P
|
2019-07-24 23:00:03 -07:00
|
|
|
Then \fBnpm update\fP will install \fBdep1@0\.4\.1\fP, because that is the highest\-sorting
|
|
|
|
version that satisfies \fB^0\.4\.0\fP (\fB>= 0\.4\.0 <0\.5\.0\fP)
|
2015-03-06 02:57:32 -06:00
|
|
|
.SS Updating Globally\-Installed Packages
|
|
|
|
.P
|
2016-02-22 11:59:14 -08:00
|
|
|
\fBnpm update \-g\fP will apply the \fBupdate\fP action to each globally installed
|
2015-07-24 15:09:52 -07:00
|
|
|
package that is \fBoutdated\fP \-\- that is, has a version that is different from
|
2020-03-19 12:53:27 -04:00
|
|
|
\fBwanted\fP\|\.
|
|
|
|
.P
|
2021-01-28 17:38:39 -05:00
|
|
|
Note: Globally installed packages are treated as if they are installed with a
|
|
|
|
caret semver range specified\. So if you require to update to \fBlatest\fP you may
|
|
|
|
need to run \fBnpm install \-g [<pkg>\.\.\.]\fP
|
2015-03-06 02:57:32 -06:00
|
|
|
.P
|
2015-07-24 15:09:52 -07:00
|
|
|
NOTE: If a package has been upgraded to a version newer than \fBlatest\fP, it will
|
2015-03-06 02:57:32 -06:00
|
|
|
be \fIdowngraded\fR\|\.
|
2019-11-05 14:55:08 -05:00
|
|
|
.SS See Also
|
2014-09-24 14:41:07 -07:00
|
|
|
.RS 0
|
|
|
|
.IP \(bu 2
|
2019-11-18 21:01:39 +02:00
|
|
|
npm help install
|
2014-09-24 14:41:07 -07:00
|
|
|
.IP \(bu 2
|
2019-11-18 21:01:39 +02:00
|
|
|
npm help outdated
|
2014-09-24 14:41:07 -07:00
|
|
|
.IP \(bu 2
|
2019-11-18 21:01:39 +02:00
|
|
|
npm help shrinkwrap
|
2015-03-06 02:57:32 -06:00
|
|
|
.IP \(bu 2
|
2019-11-05 14:55:08 -05:00
|
|
|
npm help registry
|
2014-09-24 14:41:07 -07:00
|
|
|
.IP \(bu 2
|
2019-11-05 14:55:08 -05:00
|
|
|
npm help folders
|
2014-09-24 14:41:07 -07:00
|
|
|
.IP \(bu 2
|
2019-11-18 21:01:39 +02:00
|
|
|
npm help ls
|
2014-09-24 14:41:07 -07:00
|
|
|
|
|
|
|
.RE
|