Lines Matching full:code
42 code {
49 pre > code {
145 …code>save</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#install-s…
149 <pre><code class="language-bash">npm update [<pkg>...]
152 </code></pre>
155 (specified by the <a href="../using-npm/config#tag.html"><code>tag</code> config</a>), respecting t…
159 <p>If the <code>-g</code> flag is specified, this command will update globally installed
163 <p>Note that by default <code>npm update</code> will not update the semver values of direct
164 dependencies in your project <code>package.json</code>. If you want to also update
165 values in <code>package.json</code> you can run: <code>npm update --save</code> (or add the
166 <code>save=true</code> option to a <a href="../configuring-npm/npmrc.html">configuration file</a>
169 <p>For the examples below, assume that the current package is <code>app</code> and it depends
170 on dependencies, <code>dep1</code> (<code>dep2</code>, .. etc.). The published versions of <code>d…
172 <pre><code class="language-json">{
186 </code></pre>
188 <p>If <code>app</code>'s <code>package.json</code> contains:</p>
189 <pre><code class="language-json">"dependencies": {
192 </code></pre>
193 <p>Then <code>npm update</code> will install <code>dep1@1.2.2</code>, because <code>1.2.2</code> is…
194 <code>1.2.2</code> satisfies <code>^1.1.1</code>.</p>
196 <p>However, if <code>app</code>'s <code>package.json</code> contains:</p>
197 <pre><code class="language-json">"dependencies": {
200 </code></pre>
201 <p>In this case, running <code>npm update</code> will install <code>dep1@1.1.2</code>. Even though…
202 <code>latest</code> tag points to <code>1.2.2</code>, this version does not satisfy <code>~1.1.1</c…
203 equivalent to <code>>=1.1.1 <1.2.0</code>. So the highest-sorting version that satisfies
204 <code>~1.1.1</code> is used, which is <code>1.1.2</code>.</p>
206 <p>Suppose <code>app</code> has a caret dependency on a version below <code>1.0.0</code>, for examp…
207 <pre><code class="language-json">"dependencies": {
210 </code></pre>
211 <p><code>npm update</code> will install <code>dep1@0.2.0</code>.</p>
212 <p>If the dependence were on <code>^0.4.0</code>:</p>
213 <pre><code class="language-json">"dependencies": {
216 </code></pre>
217 <p>Then <code>npm update</code> will install <code>dep1@0.4.1</code>, because that is the highest-s…
218 version that satisfies <code>^0.4.0</code> (<code>>= 0.4.0 <0.5.0</code>)</p>
220 <p>Suppose your app now also has a dependency on <code>dep2</code></p>
221 <pre><code class="language-json">{
228 </code></pre>
229 <p>and <code>dep2</code> itself depends on this limited range of <code>dep1</code></p>
230 <pre><code class="language-json">{
236 </code></pre>
237 <p>Then <code>npm update</code> will install <code>dep1@1.1.2</code> because that is the highest
238 version that <code>dep2</code> allows. npm will prioritize having a single version
239 of <code>dep1</code> in your tree rather than two when that single version can
242 you would need to use <code>npm install</code>.</p>
244 <p><code>npm update -g</code> will apply the <code>update</code> action to each globally installed
245 package that is <code>outdated</code> -- that is, has a version that is different from
246 <code>wanted</code>.</p>
248 caret semver range specified. So if you require to update to <code>latest</code> you may
249 need to run <code>npm install -g [<pkg>...]</code></p>
250 <p>NOTE: If a package has been upgraded to a version newer than <code>latest</code>, it will
253 <h4 id="save"><code>save</code></h4>
255 <li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code…
258 <p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
259 <p>When used with the <code>npm rm</code> command, removes the dependency from
260 <code>package.json</code>.</p>
261 <p>Will also prevent writing to <code>package-lock.json</code> if set to <code>false</code>.</p>
262 <h4 id="global"><code>global</code></h4>
267 <p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
271 <li>packages are installed into the <code>{prefix}/lib/node_modules</code> folder, instead
273 <li>bin files are linked to <code>{prefix}/bin</code></li>
274 <li>man pages are linked to <code>{prefix}/share/man</code></li>
276 <h4 id="install-strategy"><code>install-strategy</code></h4>
287 <h4 id="legacy-bundling"><code>legacy-bundling</code></h4>
292 <code>--install-strategy=nested</code></li>
294 <p>Instead of hoisting package installs in <code>node_modules</code>, install packages in
297 de-duplicating. Sets <code>--install-strategy=nested</code>.</p>
298 <h4 id="global-style"><code>global-style</code></h4>
303 <code>--install-strategy=shallow</code></li>
305 <p>Only install direct dependencies in the top level <code>node_modules</code>, but hoist
306 on deeper dependencies. Sets <code>--install-strategy=shallow</code>.</p>
307 <h4 id="omit"><code>omit</code></h4>
309 <li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
315 <code>package-lock.json</code> or <code>npm-shrinkwrap.json</code> file. They are just not
317 <p>If a package type appears in both the <code>--include</code> and <code>--omit</code> lists, then
319 <p>If the resulting omit list includes <code>'dev'</code>, then the <code>NODE_ENV</code> environme…
320 variable will be set to <code>'production'</code> for all lifecycle scripts.</p>
321 <h4 id="include"><code>include</code></h4>
327 <p>This is the inverse of <code>--omit=<type></code>.</p>
328 <p>Dependency types specified in <code>--include</code> will not be omitted, regardless of
330 <h4 id="strict-peer-deps"><code>strict-peer-deps</code></h4>
335 <p>If set to <code>true</code>, and <code>--legacy-peer-deps</code> is not set, then <em>any</em>
336 conflicting <code>peerDependencies</code> will be treated as an install failure, even
339 <p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
342 the range set in their package's <code>peerDependencies</code> object.</p>
344 conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
346 <h4 id="package-lock"><code>package-lock</code></h4>
351 <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This
352 will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p>
353 <h4 id="foreground-scripts"><code>foreground-scripts</code></h4>
355 <li>Default: <code>false</code> unless when using <code>npm pack</code> or <code>npm publish</code>…
356 defaults to <code>true</code></li>
359 <p>Run all build scripts (ie, <code>preinstall</code>, <code>install</code>, and <code>postinstall<…
364 <h4 id="ignore-scripts"><code>ignore-scripts</code></h4>
371 <code>npm start</code>, <code>npm stop</code>, <code>npm restart</code>, <code>npm test</code>, and…
372 will still run their intended script if <code>ignore-scripts</code> is set, but they
374 <h4 id="audit"><code>audit</code></h4>
381 documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on wh…
383 <h4 id="bin-links"><code>bin-links</code></h4>
388 <p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
393 <h4 id="fund"><code>fund</code></h4>
398 <p>When "true" displays the message at the end of each <code>npm install</code>
399 …cies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for de…
400 <h4 id="dry-run"><code>dry-run</code></h4>
407 commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
408 <code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.…
409 <p>Note: This is NOT honored by other network related commands, eg <code>dist-tags</code>,
410 <code>owner</code>, etc.</p>
411 <h4 id="workspace"><code>workspace</code></h4>
419 <p>Valid values for the <code>workspace</code> config are either:</p>
426 <p>When set for the <code>npm init</code> command, this may be set to the folder of a
430 <h4 id="workspaces"><code>workspaces</code></h4>
437 <p>Explicitly setting this to false will cause commands like <code>install</code> to
440 <li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.)
441 will link workspaces into the <code>node_modules</code> folder. - Commands that do
443 <em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li>
446 <h4 id="include-workspace-root"><code>include-workspace-root</code></h4>
452 <p>When false, specifying individual workspaces via the <code>workspace</code> config, or
453 all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
456 <h4 id="install-links"><code>install-links</code></h4>