]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/doc/cli/npm-update.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / doc / cli / npm-update.md
1 npm-update(1) -- Update a package
2 =================================
3
4 ## SYNOPSIS
5
6     npm update [-g] [<name> [<name> ...]]
7
8     aliases: up, upgrade
9
10 ## DESCRIPTION
11
12 This command will update all the packages listed to the latest version
13 (specified by the `tag` config), respecting semver.
14
15 It will also install missing packages. As with all commands that install
16 packages, the `--dev` flag will cause `devDependencies` to be processed
17 as well.
18
19 If the `-g` flag is specified, this command will update globally installed
20 packages.
21
22 If no package name is specified, all packages in the specified location (global
23 or local) will be updated.
24
25 As of `npm@2.6.1`, the `npm update` will only inspect top-level packages.
26 Prior versions of `npm` would also recursively inspect all dependencies.
27 To get the old behavior, use `npm --depth 9999 update`.
28
29 ## EXAMPLES
30
31 IMPORTANT VERSION NOTE: these examples assume `npm@2.6.1` or later.  For
32 older versions of `npm`, you must specify `--depth 0` to get the behavior
33 described below.
34
35 For the examples below, assume that the current package is `app` and it depends
36 on dependencies, `dep1` (`dep2`, .. etc.).  The published versions of `dep1` are:
37
38 ```
39 {
40   "dist-tags": { "latest": "1.2.2" },
41   "versions": [
42     "1.2.2",
43     "1.2.1",
44     "1.2.0",
45     "1.1.2",
46     "1.1.1",
47     "1.0.0",
48     "0.4.1",
49     "0.4.0",
50     "0.2.0"
51   ]
52 }
53 ```
54
55 ### Caret Dependencies
56
57 If `app`'s `package.json` contains:
58
59 ```
60 "dependencies": {
61   "dep1": "^1.1.1"
62 }
63 ```
64
65 Then `npm update` will install `dep1@1.2.2`, because `1.2.2` is `latest` and
66 `1.2.2` satisfies `^1.1.1`.
67
68 ### Tilde Dependencies
69
70 However, if `app`'s `package.json` contains:
71
72 ```
73 "dependencies": {
74   "dep1": "~1.1.1"
75 }
76 ```
77
78 In this case, running `npm update` will install `dep1@1.1.2`.  Even though the `latest`
79 tag points to `1.2.2`, this version does not satisfy `~1.1.1`, which is equivalent
80 to `>=1.1.1 <1.2.0`.  So the highest-sorting version that satisfies `~1.1.1` is used,
81 which is `1.1.2`.
82
83 ### Caret Dependencies below 1.0.0
84
85 Suppose `app` has a caret dependency on a version below `1.0.0`, for example:
86
87 ```
88 "dependencies": {
89   "dep1": "^0.2.0"
90 }
91 ```
92
93 `npm update` will install `dep1@0.2.0`, because there are no other
94 versions which satisfy `^0.2.0`.
95
96 If the dependence were on `^0.4.0`:
97
98 ```
99 "dependencies": {
100   "dep1": "^0.4.0"
101 }
102 ```
103
104 Then `npm update` will install `dep1@0.4.1`, because that is the highest-sorting
105 version that satisfies `^0.4.0` (`>= 0.4.0 <0.5.0`)
106
107 ### Recording Updates with `--save`
108
109 When you want to update a package and save the new version as
110 the minimum required dependency in `package.json`, you can use
111 `npm update --save`.  For example if `package.json` contains
112
113 ```
114 "dependencies": {
115   "dep1": "^1.1.1"
116 }
117 ```
118
119 Then `npm update --save` will install `dep1@1.2.2` (i.e., `latest`),
120 and `package.json` will be modified:
121
122 ```
123 "dependencies": {
124   "dep1": "^1.2.2"
125 }
126 ```
127
128 Note that `npm` will only write an updated version to `package.json`
129 if it installs a new package.
130
131 ### Updating Globally-Installed Packages
132
133 `npm update -g` will apply the `update` action to each globally installed
134 package that is `outdated` -- that is, has a version that is different from
135 `latest`.
136
137 NOTE: If a package has been upgraded to a version newer than `latest`, it will
138 be _downgraded_.
139
140
141 ## SEE ALSO
142
143 * npm-install(1)
144 * npm-outdated(1)
145 * npm-shrinkwrap(1)
146 * npm-registry(7)
147 * npm-folders(5)
148 * npm-ls(1)