| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 | .TH "NPM\-UPDATE" "1" "August 2021" "" "".SH "NAME"\fBnpm-update\fR \- Update a package.SS Synopsis.P.RS 2.nfnpm update [\-g] [<pkg>\.\.\.]aliases: up, upgrade.fi.RE.SS Description.PThis command will update all the packages listed to the latest version(specified by the \fBtag\fP config), respecting semver\..PIt will also install missing packages\. As with all commands that installpackages, the \fB\-\-dev\fP flag will cause \fBdevDependencies\fP to be processedas well\..PIf the \fB\-g\fP flag is specified, this command will update globally installedpackages\..PIf no package name is specified, all packages in the specified location (globalor local) will be updated\..PAs of \fBnpm@2\.6\.1\fP, the \fBnpm update\fP will only inspect top\-level packages\.Prior versions of \fBnpm\fP would also recursively inspect all dependencies\.To get the old behavior, use \fBnpm \-\-depth 9999 update\fP\|\..PAs of \fBnpm@5\.0\.0\fP, the \fBnpm update\fP will change \fBpackage\.json\fP to save the new version as the minimum required dependency\. To get the old behavior, use \fBnpm update \-\-no\-save\fP\|\..SS Example.PIMPORTANT VERSION NOTE: these examples assume \fBnpm@2\.6\.1\fP or later\.  Forolder versions of \fBnpm\fP, you must specify \fB\-\-depth 0\fP to get the behaviordescribed below\..PFor the examples below, assume that the current package is \fBapp\fP and it dependson 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.PIf \fBapp\fP\|'s \fBpackage\.json\fP contains:.P.RS 2.nf"dependencies": {  "dep1": "^1\.1\.1"}.fi.RE.PThen \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\|\..SS Tilde Dependencies.PHowever, if \fBapp\fP\|'s \fBpackage\.json\fP contains:.P.RS 2.nf"dependencies": {  "dep1": "~1\.1\.1"}.fi.RE.PIn this case, running \fBnpm update\fP will install \fBdep1@1\.1\.2\fP\|\.  Even though the \fBlatest\fPtag points to \fB1\.2\.2\fP, this version does not satisfy \fB~1\.1\.1\fP, which is equivalentto \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\|\..SS Caret Dependencies below 1\.0\.0.PSuppose \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 \fBdep1@0\.2\.0\fP, because there are no otherversions which satisfy \fB^0\.2\.0\fP\|\..PIf the dependence were on \fB^0\.4\.0\fP:.P.RS 2.nf"dependencies": {  "dep1": "^0\.4\.0"}.fi.RE.PThen \fBnpm update\fP will install \fBdep1@0\.4\.1\fP, because that is the highest\-sortingversion that satisfies \fB^0\.4\.0\fP (\fB>= 0\.4\.0 <0\.5\.0\fP).SS Updating Globally\-Installed Packages.P\fBnpm update \-g\fP will apply the \fBupdate\fP action to each globally installedpackage that is \fBoutdated\fP \-\- that is, has a version that is different from\fBwanted\fP\|\..PNote: 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.PNOTE: If a package has been upgraded to a version newer than \fBlatest\fP, it willbe \fIdowngraded\fR\|\..SS See Also.RS 0.IP \(bu 2npm help install.IP \(bu 2npm help outdated.IP \(bu 2npm help shrinkwrap.IP \(bu 2npm help registry.IP \(bu 2npm help folders.IP \(bu 2npm help ls.RE
 |