deps: upgrade npm to 8.1.4

PR-URL: https://github.com/nodejs/node/pull/40865
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
npm team 2021-11-18 20:58:02 +00:00 committed by Michaël Zasso
parent bad6526a00
commit 8a03482cf1
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
353 changed files with 8539 additions and 7416 deletions

View File

@ -65,9 +65,9 @@ let i
let sawRemovedFlags = false
for (i = 3; i < process.argv.length; i++) {
const arg = process.argv[i]
if (arg === '--')
if (arg === '--') {
break
else if (/^-/.test(arg)) {
} else if (/^-/.test(arg)) {
const [key, ...v] = arg.replace(/^-+/, '').split('=')
switch (key) {
@ -87,8 +87,9 @@ for (i = 3; i < process.argv.length; i++) {
// resolve shorthands and run again
if (shorthands[key] && !removed.has(key)) {
const a = [...shorthands[key]]
if (v.length)
if (v.length) {
a.push(v.join('='))
}
process.argv.splice(i, 1, ...a)
i--
continue
@ -109,9 +110,10 @@ for (i = 3; i < process.argv.length; i++) {
if (removed.has(key)) {
// also remove the value for the cut key.
process.argv.splice(i + 1, 1)
} else
} else {
i++
}
}
} else {
// found a positional arg, put -- in front of it, and we're done
process.argv.splice(i, 0, '--')
@ -119,7 +121,8 @@ for (i = 3; i < process.argv.length; i++) {
}
}
if (sawRemovedFlags)
if (sawRemovedFlags) {
console.error('See `npm help exec` for more information')
}
cli(process)

View File

@ -58,7 +58,7 @@ into a tarball (b).
* `npm install` (in a package directory, no arguments):
Install the dependencies in the local `node_modules` folder.
Install the dependencies to the local `node_modules` folder.
In global mode (ie, with `-g` or `--global` appended to the command),
it installs the current package context (ie, the current working

View File

@ -119,7 +119,9 @@ need to add them to `.npmignore` explicitly:
* `._*`
* `.DS_Store`
* `.git`
* `.gitignore`
* `.hg`
* `.npmignore`
* `.npmrc`
* `.lock-wscript`
* `.svn`

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-access</title>
<style>
body {
@ -181,7 +182,7 @@ authentication enabled on their account.</p>
<li>
<p>ls-packages:
Show all of the packages a user or a team is able to access, along with the
access level, except for read-only public packages (it wont print the whole
access level, except for read-only public packages (it won't print the whole
registry listing)</p>
</li>
<li>
@ -209,7 +210,7 @@ public using <code>npm publish --access=public</code>, or set their access as pu
<li>You have been given read-write privileges for a package, either as a member
of a team or directly as an owner.</li>
</ul>
<p>If you have two-factor authentication enabled then youll be prompted to
<p>If you have two-factor authentication enabled then you'll be prompted to
provide an otp token, or may use the <code>--otp=...</code> option to specify it on
the command line.</p>
<p>If your account is not paid, then attempts to publish scoped packages will
@ -222,7 +223,7 @@ fail with an HTTP 402 status code (logically enough), unless you use
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -233,7 +234,7 @@ fail with an HTTP 402 status code (logically enough), unless you use
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-adduser</title>
<style>
body {
@ -168,7 +169,7 @@ your existing record.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -176,7 +177,7 @@ your existing record.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
<li>Default: the scope of the current project, if any, or “”</li>
<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-audit</title>
<style>
body {
@ -159,13 +160,13 @@ provided, then remediations will be applied to the package tree.</p>
<p>The command will exit with a 0 exit code if no vulnerabilities were found.</p>
<p>Note that some vulnerabilities cannot be fixed automatically and will
require manual intervention or review. Also note that since <code>npm audit fix</code> runs a full-fledged <code>npm install</code> under the hood, all configs that
apply to the installer will also apply to <code>npm install</code> so things like
apply to the installer will also apply to <code>npm install</code> -- so things like
<code>npm audit fix --package-lock-only</code> will work as expected.</p>
<p>By default, the audit command will exit with a non-zero code if any
vulnerability is found. It may be useful in CI environments to include the
<code>--audit-level</code> parameter to specify the minimum vulnerability level that
will cause the command to fail. This option does not filter the report
output, it simply changes the commands failure threshold.</p>
output, it simply changes the command's failure threshold.</p>
<h3 id="audit-endpoints">Audit Endpoints</h3>
<p>There are two audit endpoints that npm may use to fetch vulnerability
information: the <code>Bulk Advisory</code> endpoint and the <code>Quick Audit</code> endpoint.</p>
@ -203,7 +204,7 @@ with the following pieces of additional metadata:</p>
<p>All packages in the tree are submitted to the Quick Audit endpoint.
Omitted dependency types are skipped when generating the report.</p>
<h4 id="scrubbing">Scrubbing</h4>
<p>Out of an abundance of caution, npm versions 5 and 6 would “scrub” any
<p>Out of an abundance of caution, npm versions 5 and 6 would "scrub" any
packages from the submitted report if their name contained a <code>/</code> character,
so as to avoid leaking the names of potentially private packages or git
URLs.</p>
@ -215,12 +216,12 @@ in package trees that used git dependencies or private modules.</p>
<h4 id="calculating-meta-vulnerabilities-and-remediations">Calculating Meta-Vulnerabilities and Remediations</h4>
<p>npm uses the
<a href="http://npm.im/@npmcli/metavuln-calculator"><code>@npmcli/metavuln-calculator</code></a>
module to turn a set of security advisories into a set of “vulnerability”
objects. A “meta-vulnerability” is a dependency that is vulnerable by
module to turn a set of security advisories into a set of "vulnerability"
objects. A "meta-vulnerability" is a dependency that is vulnerable by
virtue of dependence on vulnerable versions of a vulnerable package.</p>
<p>For example, if the package <code>foo</code> is vulnerable in the range <code>&gt;=1.0.2 &lt;2.0.0</code>, and the package <code>bar</code> depends on <code>foo@^1.1.0</code>, then that version
of <code>bar</code> can only be installed by installing a vulnerable version of <code>foo</code>.
In this case, <code>bar</code> is a “metavulnerability”.</p>
In this case, <code>bar</code> is a "metavulnerability".</p>
<p>Once metavulnerabilities for a given package are calculated, they are
cached in the <code>~/.npm</code> folder and only re-evaluated if the advisory range
changes, or a new version of the package is published (in which case, the
@ -275,7 +276,7 @@ fixing anything:</p>
<h4 id="audit-level"><code>audit-level</code></h4>
<ul>
<li>Default: null</li>
<li>Type: null, “info”, “low”, “moderate”, “high”, “critical”, or “none”</li>
<li>Type: null, "info", "low", "moderate", "high", "critical", or "none"</li>
</ul>
<p>The minimum level of vulnerability for <code>npm audit</code> to exit with a non-zero
exit code.</p>
@ -286,7 +287,7 @@ exit code.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -316,7 +317,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
<p>If you dont have a clear idea of what you want to do, it is strongly
<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -348,9 +349,9 @@ instead of checking <code>node_modules</code> and downloading dependencies.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-bin</title>
<style>
body {
@ -159,7 +160,7 @@ npm command-line interface
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-bugs</title>
<style>
body {
@ -150,7 +151,7 @@ npm command-line interface
aliases: issues
</code></pre>
<h3 id="description">Description</h3>
<p>This command tries to guess at the likely location of a packages bug
<p>This command tries to guess at the likely location of a package's bug
tracker URL or the <code>mailto</code> URL of the support email, and then tries to
open it using the <code>--browser</code> config param. If no package name is provided, it
will search for a <code>package.json</code> in the current folder and use the <code>name</code> property.</p>
@ -171,7 +172,7 @@ terminal.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-cache</title>
<style>
body {
@ -141,7 +142,7 @@ npm command-line interface
<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#details">Details</a></li><li><a href="#a-note-about-the-caches-design">A note about the caches design</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#cache"><code>cache</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#details">Details</a></li><li><a href="#a-note-about-the-caches-design">A note about the cache's design</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#cache"><code>cache</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
</section>
<div id="_content"><h3 id="synopsis">Synopsis</h3>
@ -168,7 +169,7 @@ add data to the local installation cache explicitly.</p>
<li>
<p>clean:
Delete all data out of the cache folder. Note that this is typically
unnecessary, as npms cache is self-healing and resistant to data
unnecessary, as npm's cache is self-healing and resistant to data
corruption issues.</p>
</li>
<li>
@ -195,7 +196,7 @@ manage the contents of this cache. In order to access it, <code>cacache</code> m
used directly.</p>
<p>npm will not remove data by itself: the cache will grow as new packages are
installed.</p>
<h3 id="a-note-about-the-caches-design">A note about the caches design</h3>
<h3 id="a-note-about-the-caches-design">A note about the cache's design</h3>
<p>The npm cache is strictly a cache: it should not be relied upon as a
persistent and reliable data store for package data. npm makes no guarantee
that a previously-cached piece of data will be available later, and will
@ -212,7 +213,7 @@ data that was inserted.</p>
<li>Default: Windows: <code>%LocalAppData%\npm-cache</code>, Posix: <code>~/.npm</code></li>
<li>Type: Path</li>
</ul>
<p>The location of npms cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<p>The location of npm's cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-ci</title>
<style>
body {
@ -149,9 +150,9 @@ npm command-line interface
</code></pre>
<h3 id="description">Description</h3>
<p>This command is similar to <a href="../commands/npm-install.html"><code>npm install</code></a>, except
its meant to be used in automated environments such as test platforms,
continuous integration, and deployment or any situation where you want
to make sure youre doing a clean install of your dependencies.</p>
it's meant to be used in automated environments such as test platforms,
continuous integration, and deployment -- or any situation where you want
to make sure you're doing a clean install of your dependencies.</p>
<p><code>npm ci</code> will be significantly faster when:</p>
<ul>
<li>There is a <code>package-lock.json</code> or <code>npm-shrinkwrap.json</code> file.</li>
@ -199,7 +200,7 @@ cache:
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -219,7 +220,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-completion</title>
<style>
body {
@ -162,7 +163,7 @@ such as <code>/usr/local/etc/bash_completion.d/npm</code> or
<code>/etc/bash_completion.d/npm</code> if you have a system that will read
that file for you.</p>
<p>When <code>COMP_CWORD</code>, <code>COMP_LINE</code>, and <code>COMP_POINT</code> are defined in the
environment, <code>npm completion</code> acts in “plumbing mode”, and outputs
environment, <code>npm completion</code> acts in "plumbing mode", and outputs
completions based on the arguments.</p>
<h3 id="see-also">See Also</h3>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-config</title>
<style>
body {
@ -219,7 +220,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -232,8 +233,8 @@ of the current working directory.</li>
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
<li>Default: The EDITOR or VISUAL environment variables, or notepad.exe on
Windows, or vim on Unix systems</li>
<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>
@ -241,9 +242,9 @@ Windows, or vim on Unix systems</li>
<!-- raw HTML omitted -->
<h4 id="location"><code>location</code></h4>
<ul>
<li>Default: “user” unless <code>--global</code> is passed, which will also set this value
to “global”</li>
<li>Type: “global”, “user”, or “project”</li>
<li>Default: "user" unless <code>--global</code> is passed, which will also set this value
to "global"</li>
<li>Type: "global", "user", or "project"</li>
</ul>
<p>When passed to <code>npm config</code> this refers to which config file to use.</p>
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-dedupe</title>
<style>
body {
@ -167,7 +168,7 @@ be more effectively shared by multiple dependent packages.</p>
+-- d
`-- c@1.0.10
</code></pre>
<p>Because of the hierarchical nature of nodes module lookup, b and d
<p>Because of the hierarchical nature of node's module lookup, b and d
will both get their dependency met by the single c package at the root
level of the tree.</p>
<p>In some cases, you may have a dependency graph like this:</p>
@ -178,7 +179,7 @@ level of the tree.</p>
`-- c@1.9.9
</code></pre>
<p>During the installation process, the <code>c@1.0.3</code> dependency for <code>b</code> was
placed in the root of the tree. Though <code>d</code>s dependency on <code>c@1.x</code> could
placed in the root of the tree. Though <code>d</code>'s dependency on <code>c@1.x</code> could
have been satisfied by <code>c@1.0.3</code>, the newer <code>c@1.9.0</code> dependency was used,
because npm favors updates by default, even when doing so causes
duplication.</p>
@ -231,7 +232,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -251,9 +252,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -282,7 +283,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -296,7 +297,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -305,7 +306,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -314,7 +315,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-deprecate</title>
<style>
body {
@ -171,7 +172,7 @@ format an empty string.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -182,7 +183,7 @@ format an empty string.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-diff</title>
<style>
body {
@ -158,13 +159,13 @@ of files for packages published to the npm registry.</p>
<li>
<p><code>npm diff --diff=&lt;spec-a&gt; --diff=&lt;spec-b&gt;</code></p>
<p>Compares two package versions using their registry specifiers, e.g:
<code>npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0</code>. Its also possible to
<code>npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0</code>. It's also possible to
compare across forks of any package,
e.g: <code>npm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0</code>.</p>
<p>Any valid spec can be used, so that its also possible to compare
<p>Any valid spec can be used, so that it's also possible to compare
directories or git repositories,
e.g: <code>npm diff --diff=pkg@latest --diff=./packages/pkg</code></p>
<p>Heres an example comparing two different versions of a package named
<p>Here's an example comparing two different versions of a package named
<code>abbrev</code> from the registry:</p>
<pre lang="bash"><code>npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1
</code></pre>
@ -220,7 +221,7 @@ newer one if the version numbers are not the same.</p>
</li>
<li>
<p><code>npm diff --diff=&lt;spec-a&gt;</code> (in a package directory):</p>
<p>Similar to using only a single package name, its also possible to declare
<p>Similar to using only a single package name, it's also possible to declare
a full registry specifier version if you wish to compare the local version
of an installed package with the specific version/tag/semver-range provided
in <code>&lt;spec-a&gt;</code>.</p>
@ -240,7 +241,7 @@ to compare different versions of the current package.</p>
<code>npm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1</code>.</p>
<p>If only a single argument <code>&lt;version-a&gt;</code> is provided, then the current local
file system is going to be compared against that version.</p>
<p>Heres an example comparing two specific versions (published to the
<p>Here's an example comparing two specific versions (published to the
configured registry) of the current project directory:</p>
<pre lang="bash"><code>npm diff --diff=1.0.0 --diff=1.1.0
</code></pre>
@ -249,7 +250,7 @@ configured registry) of the current project directory:</p>
<p>Note that tag names are not valid <code>--diff</code> argument values, if you wish to
compare to a published tag, you must use the <code>pkg@tagname</code> syntax.</p>
<h4 id="filtering-files">Filtering files</h4>
<p>Its possible to also specify positional arguments using file names or globs
<p>It's possible to also specify positional arguments using file names or globs
pattern matching in order to limit the result of diff patches to only a subset
of files for a given package, e.g:</p>
<pre lang="bash"><code>npm diff --diff=pkg@2 ./lib/ CHANGELOG.md
@ -305,7 +306,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<!-- raw HTML omitted -->
<h4 id="diff-src-prefix"><code>diff-src-prefix</code></h4>
<ul>
<li>Default: “a/”</li>
<li>Default: "a/"</li>
<li>Type: String</li>
</ul>
<p>Source prefix to be used in <code>npm diff</code> output.</p>
@ -313,7 +314,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<!-- raw HTML omitted -->
<h4 id="diff-dst-prefix"><code>diff-dst-prefix</code></h4>
<ul>
<li>Default: “b/”</li>
<li>Default: "b/"</li>
<li>Type: String</li>
</ul>
<p>Destination prefix to be used in <code>npm diff</code> output.</p>
@ -332,7 +333,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -345,10 +346,10 @@ of the current working directory.</li>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
<li>Default: “latest”</li>
<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
<p>If you ask npm to install a package and dont tell it a specific version,
<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-dist-tag</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-docs</title>
<style>
body {
@ -150,7 +151,7 @@ npm command-line interface
aliases: home
</code></pre>
<h3 id="description">Description</h3>
<p>This command tries to guess at the likely location of a packages
<p>This command tries to guess at the likely location of a package's
documentation URL, and then tries to open it using the <code>--browser</code> config
param. You can pass multiple package names at once. If no package name is
provided, it will search for a <code>package.json</code> in the current folder and use
@ -172,7 +173,7 @@ terminal.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-doctor</title>
<style>
body {
@ -158,10 +159,10 @@ standalone tool, but it does have some basic requirements that must be met:</p>
uses the registry API, is available.</li>
<li>The directories that npm uses, <code>node_modules</code> (both locally and
globally), exist and can be written by the current user.</li>
<li>The npm cache exists, and the package tarballs within it arent corrupt.</li>
<li>The npm cache exists, and the package tarballs within it aren't corrupt.</li>
</ul>
<p>Without all of these working properly, npm may not work properly. Many
issues are often attributable to things that are outside npms code base,
issues are often attributable to things that are outside npm's code base,
so <code>npm doctor</code> confirms that the npm installation is in a good state.</p>
<p>Also, in addition to this, there are also very many issue reports due to
using old versions of npm. Since npm is constantly improving, running
@ -174,48 +175,48 @@ are any recommended changes, it will display them.</p>
registry. This can also be checked with <code>npm ping</code>. If this check fails,
you may be using a proxy that needs to be configured, or may need to talk
to your IT staff to get access over HTTPS to <code>registry.npmjs.org</code>.</p>
<p>This check is done against whichever registry youve configured (you can
see what that is by running <code>npm config get registry</code>), and if youre using
a private registry that doesnt support the <code>/whoami</code> endpoint supported by
<p>This check is done against whichever registry you've configured (you can
see what that is by running <code>npm config get registry</code>), and if you're using
a private registry that doesn't support the <code>/whoami</code> endpoint supported by
the primary registry, this check may fail.</p>
<h4 id="npm--v"><code>npm -v</code></h4>
<p>While Node.js may come bundled with a particular version of npm, its the
<p>While Node.js may come bundled with a particular version of npm, it's the
policy of the CLI team that we recommend all users run <code>npm@latest</code> if they
can. As the CLI is maintained by a small team of contributors, there are
only resources for a single line of development, so npms own long-term
only resources for a single line of development, so npm's own long-term
support releases typically only receive critical security and regression
fixes. The team believes that the latest tested version of npm is almost
always likely to be the most functional and defect-free version of npm.</p>
<h4 id="node--v"><code>node -v</code></h4>
<p>For most users, in most circumstances, the best version of Node will be the
latest long-term support (LTS) release. Those of you who want access to new
ECMAscript features or bleeding-edge changes to Nodes standard library may
ECMAscript features or bleeding-edge changes to Node's standard library may
be running a newer version, and some may be required to run an older
version of Node because of enterprise change control policies. Thats OK!
version of Node because of enterprise change control policies. That's OK!
But in general, the npm team recommends that most users run Node.js LTS.</p>
<h4 id="npm-config-get-registry"><code>npm config get registry</code></h4>
<p>You may be installing from private package registries for your project or
company. Thats great! Others may be following tutorials or StackOverflow
company. That's great! Others may be following tutorials or StackOverflow
questions in an effort to troubleshoot problems you may be having.
Sometimes, this may entail changing the registry youre pointing at. This
part of <code>npm doctor</code> just lets you, and maybe whoevers helping you with
support, know that youre not using the default registry.</p>
Sometimes, this may entail changing the registry you're pointing at. This
part of <code>npm doctor</code> just lets you, and maybe whoever's helping you with
support, know that you're not using the default registry.</p>
<h4 id="which-git"><code>which git</code></h4>
<p>While its documented in the README, it may not be obvious that npm needs
<p>While it's documented in the README, it may not be obvious that npm needs
Git installed to do many of the things that it does. Also, in some cases
&nbsp;especially on Windows &nbsp;you may have Git set up in such a way that its
&nbsp;especially on Windows &nbsp;you may have Git set up in such a way that it's
not accessible via your <code>PATH</code> so that npm can find it. This check ensures
that Git is available.</p>
<h4 id="permissions-checks">Permissions checks</h4>
<ul>
<li>Your cache must be readable and writable by the user running npm.</li>
<li>Global package binaries must be writable by the user running npm.</li>
<li>Your local <code>node_modules</code> path, if youre running <code>npm doctor</code> with a
<li>Your local <code>node_modules</code> path, if you're running <code>npm doctor</code> with a
project directory, must be readable and writable by the user running npm.</li>
</ul>
<h4 id="validate-the-checksums-of-cached-packages">Validate the checksums of cached packages</h4>
<p>When an npm package is published, the publishing process generates a
checksum that npm uses at install time to verify that the package didnt
checksum that npm uses at install time to verify that the package didn't
get corrupted in transit. <code>npm doctor</code> uses these checksums to validate the
package tarballs in your local cache (you can see where that cache is
located with <code>npm config get cache</code>). In the event that there are corrupt
@ -227,7 +228,7 @@ reset the cache.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-edit</title>
<style>
body {
@ -150,8 +151,8 @@ npm command-line interface
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>Selects a dependency in the current project and opens the package folder in
the default editor (or whatever youve configured as the npm <code>editor</code>
config see <a href="npm-config"><code>npm-config</code></a>.)</p>
the default editor (or whatever you've configured as the npm <code>editor</code>
config -- see <a href="npm-config"><code>npm-config</code></a>.)</p>
<p>After it has been edited, the package is rebuilt so as to pick up any
changes in compiled packages.</p>
<p>For instance, you can do <code>npm install connect</code> to install connect
@ -163,8 +164,8 @@ changes to your locally installed copy.</p>
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
<li>Default: The EDITOR or VISUAL environment variables, or notepad.exe on
Windows, or vim on Unix systems</li>
<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-exec</title>
<style>
body {
@ -207,7 +208,7 @@ the first command argument.</p>
<h3 id="npx-vs-npm-exec"><code>npx</code> vs <code>npm exec</code></h3>
<p>When run via the <code>npx</code> binary, all flags and options <em>must</em> be set prior to
any positional arguments. When run via <code>npm exec</code>, a double-hyphen <code>--</code>
flag can be used to suppress npms parsing of switches and options that
flag can be used to suppress npm's parsing of switches and options that
should be sent to the executed command.</p>
<p>For example:</p>
<pre><code>$ npx foo@latest bar --package=@npmcli/foo
@ -218,7 +219,7 @@ following command:</p>
</code></pre>
<p>Since the <code>--package</code> option comes <em>after</em> the positional arguments, it is
treated as an argument to the executed command.</p>
<p>In contrast, due to npms argument parsing logic, running this command is
<p>In contrast, due to npm's argument parsing logic, running this command is
different:</p>
<pre><code>$ npm exec foo@latest bar --package=@npmcli/foo
</code></pre>
@ -246,7 +247,7 @@ thus be equivalent to the <code>npx</code> command above:</p>
<!-- raw HTML omitted -->
<h4 id="call"><code>call</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Optional companion option for <code>npm exec</code>, <code>npx</code> that allows for specifying a
@ -348,12 +349,12 @@ at a time.</p>
</code></pre>
<p>You can execute an arbitrary command from a package in the context of each of
the configured workspaces when using the <code>workspaces</code> configuration options,
in this example were using <strong>eslint</strong> to lint any js file found within each
in this example we're using <strong>eslint</strong> to lint any js file found within each
workspace folder:</p>
<pre><code>npm exec --ws -- eslint ./*.js
</code></pre>
<h4 id="filtering-workspaces">Filtering workspaces</h4>
<p>Its also possible to execute a command in a single workspace using the
<p>It's also possible to execute a command in a single workspace using the
<code>workspace</code> config along with a name or directory path:</p>
<pre><code>npm exec --workspace=a -- eslint ./*.js
</code></pre>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-explain</title>
<style>
body {
@ -155,7 +156,7 @@ to be installed in the current project.</p>
<p>Positional arguments can be either folders within <code>node_modules</code>, or
<code>name@version-range</code> specifiers, which will select the dependency
relationships to explain.</p>
<p>For example, running <code>npm explain glob</code> within npms source tree will show:</p>
<p>For example, running <code>npm explain glob</code> within npm's source tree will show:</p>
<pre lang="bash"><code>glob@7.1.6
node_modules/glob
glob@"^7.1.4" from the root project

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-explore</title>
<style>
body {
@ -164,7 +165,7 @@ sure to use <code>npm rebuild &lt;pkg&gt;</code> if you make any changes.</p>
<!-- raw HTML omitted -->
<h4 id="shell"><code>shell</code></h4>
<ul>
<li>Default: SHELL environment variable, or “bash” on Posix, or “cmd.exe” on
<li>Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on
Windows</li>
<li>Type: String</li>
</ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-find-dupes</title>
<style>
body {
@ -190,7 +191,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -210,9 +211,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -241,7 +242,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -255,7 +256,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -264,7 +265,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-fund</title>
<style>
body {
@ -161,10 +162,10 @@ share the same url as a single entry. Thus, the list does not have the same
shape of the output from <code>npm ls</code>.</p>
<h4 id="example">Example</h4>
<h3 id="workspaces-support">Workspaces support</h3>
<p>Its possible to filter the results to only include a single workspace and its
<p>It's possible to filter the results to only include a single workspace and its
dependencies using the <code>workspace</code> config option.</p>
<h4 id="example2">Example:</h4>
<p>Heres an example running <code>npm fund</code> in a project with a configured
<p>Here's an example running <code>npm fund</code> in a project with a configured
workspace <code>a</code>:</p>
<pre lang="bash"><code>$ npm fund
test-workspaces-fund@1.0.0

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-help-search</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-help</title>
<style>
body {
@ -160,7 +161,7 @@ topic, so unique matches are equivalent to specifying a topic name.</p>
<!-- raw HTML omitted -->
<h4 id="viewer"><code>viewer</code></h4>
<ul>
<li>Default: “man” on Posix, “browser” on Windows</li>
<li>Default: "man" on Posix, "browser" on Windows</li>
<li>Type: String</li>
</ul>
<p>The program to use to view help content.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-hook</title>
<style>
body {
@ -183,7 +184,7 @@ the request came from your own configured hook.</p>
<p>List your active hooks for the <code>lodash</code> package:</p>
<pre lang="bash"><code>$ npm hook ls lodash
</code></pre>
<p>Update an existing hooks url:</p>
<p>Update an existing hook's url:</p>
<pre lang="bash"><code>$ npm hook update id-deadbeef https://my-new-website.here/
</code></pre>
<p>Remove a hook:</p>
@ -195,7 +196,7 @@ the request came from your own configured hook.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -206,7 +207,7 @@ the request came from your own configured hook.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
@ -215,7 +216,7 @@ password, npm will prompt on the command line for one.</p>
<!-- raw HTML omitted -->
<h3 id="see-also">See Also</h3>
<ul>
<li><a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">“Introducing Hooks” blog post</a></li>
<li><a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">"Introducing Hooks" blog post</a></li>
</ul>
</div>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-init</title>
<style>
body {
@ -155,7 +156,7 @@ npm init [-w &lt;dir&gt;] [args...]
package.</p>
<p><code>initializer</code> in this case is an npm package named <code>create-&lt;initializer&gt;</code>,
which will be installed by <a href="../commands/npm-exec.html"><code>npm-exec</code></a>, and then have its
main bin executed presumably creating or updating <code>package.json</code> and
main bin executed -- presumably creating or updating <code>package.json</code> and
running any other initialization-related operations.</p>
<p>The init command is transformed to a corresponding <code>npm exec</code> operation as
follows:</p>
@ -173,7 +174,7 @@ set. You can also use <code>-y</code>/<code>--yes</code> to skip the questionnai
you pass <code>--scope</code>, it will create a scoped package.</p>
<h4 id="forwarding-additional-options">Forwarding additional options</h4>
<p>Any additional options will be passed directly to the command, so <code>npm init foo -- --hello</code> will map to <code>npm exec -- create-foo --hello</code>.</p>
<p>To better illustrate how options are forwarded, heres a more evolved
<p>To better illustrate how options are forwarded, here's a more evolved
example showing options passed to both the <strong>npm cli</strong> and a create package,
both following commands are equivalent:</p>
<ul>
@ -199,7 +200,7 @@ $ npm init
<pre lang="bash"><code>$ npm init -y
</code></pre>
<h3 id="workspaces-support">Workspaces support</h3>
<p>Its possible to create a new workspace within your project by using the
<p>It's possible to create a new workspace within your project by using the
<code>workspace</code> config option. When using <code>npm init -w &lt;dir&gt;</code> the cli will
create the folders and boilerplate expected while also adding a reference
to your project <code>package.json</code> <code>"workspaces": []</code> property in order to make
@ -230,7 +231,7 @@ project and configure your <code>package.json</code> to recognize it as such:</p
</code></pre>
<p>This will make sure to generate your react app as expected, one important
consideration to have in mind is that <code>npm exec</code> is going to be run in the
context of the newly created folder for that workspace, and thats the reason
context of the newly created folder for that workspace, and that's the reason
why in this example the initializer uses the initializer name followed with a
dot to represent the current directory in that context, e.g: <code>react-app .</code>:</p>
<pre><code>.
@ -252,7 +253,7 @@ dot to represent the current directory in that context, e.g: <code>react-app .</
<li>Default: null</li>
<li>Type: null or Boolean</li>
</ul>
<p>Automatically answer “yes” to any prompts that npm might print on the
<p>Automatically answer "yes" to any prompts that npm might print on the
command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -278,7 +279,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
<p>If you dont have a clear idea of what you want to do, it is strongly
<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-install-ci-test</title>
<style>
body {
@ -160,7 +161,7 @@ alias: npm cit
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -180,7 +181,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-install-test</title>
<style>
body {
@ -180,7 +181,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
rather than using npms default semver range operator.</p>
rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@ -188,7 +189,7 @@ rather than using npms default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -235,7 +236,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -255,9 +256,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -286,7 +287,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -300,7 +301,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -309,7 +310,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -318,7 +319,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-install</title>
<style>
body {
@ -182,7 +183,7 @@ following order of precedence:</p>
<a href="../using-npm/registry.html"><code>registry</code></a>) with (c)</li>
<li>e) a <code>&lt;name&gt;@&lt;tag&gt;</code> (see <a href="../commands/npm-dist-tag.html"><code>npm dist-tag</code></a>) that
points to (d)</li>
<li>f) a <code>&lt;name&gt;</code> that has a “latest” tag satisfying (e)</li>
<li>f) a <code>&lt;name&gt;</code> that has a "latest" tag satisfying (e)</li>
<li>g) a <code>&lt;git remote url&gt;</code> that resolves to (a)</li>
</ul>
<p>Even if you never publish your package, you can still get a lot of benefits
@ -192,7 +193,7 @@ into a tarball (b).</p>
<ul>
<li>
<p><code>npm install</code> (in a package directory, no arguments):</p>
<p>Install the dependencies in the local <code>node_modules</code> folder.</p>
<p>Install the dependencies to the local <code>node_modules</code> folder.</p>
<p>In global mode (ie, with <code>-g</code> or <code>--global</code> appended to the command),
it installs the current package context (ie, the current working
directory) as a global package.</p>
@ -211,7 +212,7 @@ dependency to a project.</p>
<li>
<p><code>npm install &lt;folder&gt;</code>:</p>
<p>Install the package in the directory as a symlink in the current
project. Its dependencies will be installed before its linked. If
project. Its dependencies will be installed before it's linked. If
<code>&lt;folder&gt;</code> sits inside the root of your project, its dependencies may
be hoisted to the top-level <code>node_modules</code> as they would for other
types of dependencies.</p>
@ -238,15 +239,15 @@ when installing the package (an equivalent of <code>tar x --strip-components=1</
<li>
<p><code>npm install &lt;tarball url&gt;</code>:</p>
<p>Fetch the tarball url, and then install it. In order to distinguish between
this and other options, the argument must start with “http://” or “https://”</p>
this and other options, the argument must start with "http://" or "https://"</p>
<p>Example:</p>
<pre lang="bash"><code>npm install https://github.com/indexzero/forever/tarball/v0.5.6
</code></pre>
</li>
<li>
<p><code>npm install [&lt;@scope&gt;/]&lt;name&gt;</code>:</p>
<p>Do a <code>&lt;name&gt;@&lt;tag&gt;</code> install, where <code>&lt;tag&gt;</code> is the “tag” config. (See
<a href="../using-npm/config.html"><code>config</code></a>. The configs default value is <code>latest</code>.)</p>
<p>Do a <code>&lt;name&gt;@&lt;tag&gt;</code> install, where <code>&lt;tag&gt;</code> is the "tag" config. (See
<a href="../using-npm/config.html"><code>config</code></a>. The config's default value is <code>latest</code>.)</p>
<p>In most cases, this will install the version of the modules tagged as
<code>latest</code> on the npm registry.</p>
<p>Example:</p>
@ -276,7 +277,7 @@ package.json, there are two additional, optional flags:</p>
<ul>
<li>
<p><code>-E, --save-exact</code>: Saved dependencies will be configured with an
exact version rather than using npms default semver range operator.</p>
exact version rather than using npm's default semver range operator.</p>
</li>
<li>
<p><code>-B, --save-bundle</code>: Saved dependencies will also be added to your
@ -480,7 +481,7 @@ even if a local copy exists on disk.</p>
</code></pre>
<h3 id="configuration">Configuration</h3>
<p>See the <a href="../using-npm/config.html"><code>config</code></a> help doc. Many of the configuration
params have some effect on installation, since thats most of what npm
params have some effect on installation, since that's most of what npm
does.</p>
<p>These are some of the most common options related to installation.</p>
<!-- raw HTML omitted -->
@ -502,7 +503,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
rather than using npms default semver range operator.</p>
rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@ -510,7 +511,7 @@ rather than using npms default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -557,7 +558,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -577,9 +578,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -608,7 +609,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -622,7 +623,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -631,7 +632,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -640,7 +641,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -717,7 +718,7 @@ level because nothing conflicts with it.</p>
`-- D@2
+-- D@1
</code></pre>
<p>Because Bs D@1 will be installed in the top-level, C now has to install
<p>Because B's D@1 will be installed in the top-level, C now has to install
D@2 privately for itself. This algorithm is deterministic, but different
trees may be produced if two dependencies are requested for installation in
a different order.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-link</title>
<style>
body {
@ -168,7 +169,7 @@ directory name.</p>
<a href="../using-npm/scope.html"><code>scope</code></a>. The scope must be preceded by an @-symbol and
followed by a slash.</p>
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
“snapshotted” to their current state by resolving the symbolic links, if
"snapshotted" to their current state by resolving the symbolic links, if
they are included in <code>bundleDependencies</code>.</p>
<p>For example:</p>
<pre lang="bash"><code>cd ~/projects/node-redis # go into the package directory
@ -189,7 +190,7 @@ npm link ../node-redis # link the dir of your dependency
npm link redis
</code></pre>
<p>That is, it first creates a global link, and then links the global
installation target into your projects <code>node_modules</code> folder.</p>
installation target into your project's <code>node_modules</code> folder.</p>
<p>Note that in this case, you are referring to the directory name,
<code>node-redis</code>, rather than the package name <code>redis</code>.</p>
<p>If your linked package is scoped (see <a href="../using-npm/scope.html"><code>scope</code></a>) your
@ -202,7 +203,7 @@ link command must include that scope, e.g.</p>
a link stand in for a regular non-link dependency. Otherwise, for example,
if you depend on <code>redis@^3.0.1</code>, and ran <code>npm link redis</code>, it would replace
the <code>^3.0.1</code> dependency with <code>file:../path/to/node-redis</code>, which you
probably dont want! Additionally, other users or developers on your
probably don't want! Additionally, other users or developers on your
project would run into issues if they do not have their folders set up
exactly the same as yours.</p>
<p>If you are adding a <em>new</em> dependency as a link, you should add it to the
@ -212,7 +213,7 @@ relevant metadata by running <code>npm install &lt;dep&gt; --package-lock-only</
<h3 id="workspace-usage">Workspace Usage</h3>
<p><code>npm link &lt;pkg&gt; --workspace &lt;name&gt;</code> will link the relevant package as a
dependency of the specified workspace(s). Note that It may actually be
linked into the parent projects <code>node_modules</code> folder, if there are no
linked into the parent project's <code>node_modules</code> folder, if there are no
conflicting dependencies.</p>
<p><code>npm link --workspace &lt;name&gt;</code> will create a global link to the specified
workspace(s).</p>
@ -236,7 +237,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
rather than using npms default semver range operator.</p>
rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@ -244,7 +245,7 @@ rather than using npms default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -291,7 +292,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -311,9 +312,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -342,7 +343,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -356,7 +357,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -365,7 +366,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -374,7 +375,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-logout</title>
<style>
body {
@ -150,8 +151,8 @@ npm command-line interface
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>When logged into a registry that supports token-based authentication, tell
the server to end this tokens session. This will invalidate the token
everywhere youre using it, not just for the current environment.</p>
the server to end this token's session. This will invalidate the token
everywhere you're using it, not just for the current environment.</p>
<p>When logged into a legacy registry that uses username and password
authentication, this will clear the credentials in your user configuration.
In this case, it will <em>only</em> affect the current environment.</p>
@ -163,7 +164,7 @@ connected to that scope, if set.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -171,7 +172,7 @@ connected to that scope, if set.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
<li>Default: the scope of the current project, if any, or “”</li>
<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-ls</title>
<style>
body {
@ -153,13 +154,13 @@ aliases: list, la, ll
<p>This command will print to stdout all the versions of packages that are
installed, as well as their dependencies when <code>--all</code> is specified, in a
tree structure.</p>
<p>Note: to get a “bottoms up” view of why a given package is included in the
<p>Note: to get a "bottoms up" view of why a given package is included in the
tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code></a>.</p>
<p>Positional arguments are <code>name@version-range</code> identifiers, which will limit
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npms source tree will show:</p>
<pre lang="bash"><code>npm@8.1.3 /path/to/npm
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
<pre lang="bash"><code>npm@8.1.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
@ -171,7 +172,7 @@ recognize potential forks of a project.</p>
dependencies, not the physical layout of your <code>node_modules</code> folder.</p>
<p>When run as <code>ll</code> or <code>la</code>, it shows extended information by default.</p>
<h3 id="note-design-changes-pending">Note: Design Changes Pending</h3>
<p>The <code>npm ls</code> commands output and behavior made a <em>ton</em> of sense when npm
<p>The <code>npm ls</code> command's output and behavior made a <em>ton</em> of sense when npm
created a <code>node_modules</code> folder that naively nested every dependency. In
such a case, the logical dependency graph and physical tree of packages on
disk would be roughly identical.</p>
@ -182,7 +183,7 @@ However, without using <code>npm ls -l</code>, it became impossible show <em>whe
package was actually installed much of the time!</p>
<p>With the advent of automatic installation of <code>peerDependencies</code> in npm v7,
this gets even more curious, as <code>peerDependencies</code> are logically
“underneath” their dependents in the dependency graph, but are always
"underneath" their dependents in the dependency graph, but are always
physically at or above their location on disk.</p>
<p>Also, in the years since npm got an <code>ls</code> command (in version 0.0.2!),
dependency graphs have gotten much larger as a general rule. Therefore, in
@ -240,7 +241,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -263,9 +264,9 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-org</title>
<style>
body {
@ -179,7 +180,7 @@ listing them, and finding specific ones and their roles.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -190,7 +191,7 @@ listing them, and finding specific ones and their roles.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-outdated</title>
<style>
body {
@ -156,15 +157,15 @@ Use <code>--all</code> to find all outdated meta-dependencies as well.</p>
<p>In the output:</p>
<ul>
<li><code>wanted</code> is the maximum version of the package that satisfies the semver
range specified in <code>package.json</code>. If theres no available semver range
(i.e. youre running <code>npm outdated --global</code>, or the package isnt
range specified in <code>package.json</code>. If there's no available semver range
(i.e. you're running <code>npm outdated --global</code>, or the package isn't
included in <code>package.json</code>), then <code>wanted</code> shows the currently-installed
version.</li>
<li><code>latest</code> is the version of the package tagged as latest in the registry.
Running <code>npm publish</code> with no special configuration will publish the
package with a dist-tag of <code>latest</code>. This may or may not be the maximum
version of the package, or the most-recently published version of the
package, depending on how the packages developer manages the latest
package, depending on how the package's developer manages the latest
<a href="../commands/npm-dist-tag.html">dist-tag</a>.</li>
<li><code>location</code> is where in the physical tree the package is located.</li>
<li><code>depended by</code> shows which package depends on the displayed dependency</li>
@ -172,10 +173,10 @@ package, depending on how the packages developer manages the latest
package is a <code>dependency</code> or a dev/peer/optional dependency. Packages not
included in <code>package.json</code> are always marked <code>dependencies</code>.</li>
<li><code>homepage</code> (when using <code>--long</code> / <code>-l</code>) is the <code>homepage</code> value contained
in the packages packument</li>
<li>Red means theres a newer version matching your semver requirements, so
in the package's packument</li>
<li>Red means there's a newer version matching your semver requirements, so
you should update now.</li>
<li>Yellow indicates that theres a newer version <em>above</em> your semver
<li>Yellow indicates that there's a newer version <em>above</em> your semver
requirements (usually new major, or new 0.x minor) so proceed with
caution.</li>
</ul>
@ -200,16 +201,16 @@ once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-pack
<ul>
<li><code>glob</code> requires <code>^5</code>, which prevents npm from installing <code>glob@6</code>, which
is outside the semver range.</li>
<li>Git dependencies will always be reinstalled, because of how theyre
<li>Git dependencies will always be reinstalled, because of how they're
specified. The installed committish might satisfy the dependency
specifier (if its something immutable, like a commit SHA), or it might
specifier (if it's something immutable, like a commit SHA), or it might
not, so <code>npm outdated</code> and <code>npm update</code> have to fetch Git repos to check.
This is why currently doing a reinstall of a Git dependency always forces
a new clone and install.</li>
<li><code>npm@3.5.2</code> is marked as “wanted”, but “latest” is <code>npm@3.5.1</code> because
<li><code>npm@3.5.2</code> is marked as "wanted", but "latest" is <code>npm@3.5.1</code> because
npm uses dist-tags to manage its <code>latest</code> and <code>next</code> release channels.
<code>npm update</code> will install the <em>newest</em> version, but <code>npm install npm</code>
(with no semver range) will install whatevers tagged as <code>latest</code>.</li>
(with no semver range) will install whatever's tagged as <code>latest</code>.</li>
<li><code>once</code> is just plain out of date. Reinstalling <code>node_modules</code> from
scratch or running <code>npm update</code> will bring it up to spec.</li>
</ul>
@ -262,7 +263,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-owner</title>
<style>
body {
@ -163,10 +164,10 @@ to modify metadata, publish new versions, and add other owners.</li>
their privileges.</li>
</ul>
<p>Note that there is only one level of access. Either you can modify a package,
or you cant. Future versions may contain more fine-grained access levels, but
or you can't. Future versions may contain more fine-grained access levels, but
that is not implemented at this time.</p>
<p>If you have two-factor authentication enabled with <code>auth-and-writes</code> (see
<a href="../commands/npm-profile.html"><code>npm-profile</code></a>) then youll need to include an otp
<a href="../commands/npm-profile.html"><code>npm-profile</code></a>) then you'll need to include an otp
on the command line when changing ownership with <code>--otp</code>.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@ -174,7 +175,7 @@ on the command line when changing ownership with <code>--otp</code>.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -185,7 +186,7 @@ on the command line when changing ownership with <code>--otp</code>.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-pack</title>
<style>
body {
@ -156,7 +157,7 @@ npm command-line interface
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -179,7 +180,7 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="pack-destination"><code>pack-destination</code></h4>
<ul>
<li>Default: “.”</li>
<li>Default: "."</li>
<li>Type: String</li>
</ul>
<p>Directory in which <code>npm pack</code> will save tarballs.</p>
@ -237,7 +238,7 @@ the specified workspaces, and not on the root project.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h3 id="description">Description</h3>
<p>For anything thats installable (that is, a package folder, tarball,
<p>For anything that's installable (that is, a package folder, tarball,
tarball url, git url, name@tag, name@version, name, or scoped name), this
command will fetch it to the cache, copy the tarball to the current working
directory as <code>&lt;name&gt;-&lt;version&gt;.tgz</code>, and then write the filenames out to

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-ping</title>
<style>
body {
@ -162,7 +163,7 @@ If it works it will output something like:</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-pkg</title>
<style>
body {
@ -154,7 +155,7 @@ npm pkg delete &lt;field&gt; [.&lt;subfield&gt; ...]
<code>npm pkg</code> provide 3 different sub commands that allow you to modify or retrieve
values for given object keys in your <code>package.json</code>.</p>
<p>The syntax to retrieve and set fields is a dot separated representation of
the nested object properties to be found within your <code>package.json</code>, its the
the nested object properties to be found within your <code>package.json</code>, it's the
same notation used in <a href="../commands/npm-view.html"><code>npm view</code></a> to retrieve information
from the registry manifest, below you can find more examples on how to use it.</p>
<p>Returned values are always in <strong>json</strong> format.</p>
@ -166,7 +167,7 @@ from the registry manifest, below you can find more examples on how to use it.</
can run:</p>
<pre lang="bash"><code>npm pkg get name
</code></pre>
<p>Its also possible to retrieve multiple values at once:</p>
<p>It's also possible to retrieve multiple values at once:</p>
<pre lang="bash"><code>npm pkg get name version
</code></pre>
<p>You can view child fields by separating them with a period. To retrieve
@ -202,7 +203,7 @@ to a file <code>cli.js</code>:</p>
<p>Setting multiple fields at once is also possible:</p>
<pre lang="bash"><code>npm pkg set description='Awesome package' engines.node='&gt;=10'
</code></pre>
<p>Its also possible to add to array values, for example to add a new
<p>It's also possible to add to array values, for example to add a new
contributor entry:</p>
<pre lang="bash"><code>npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca'
</code></pre>
@ -210,7 +211,7 @@ contributor entry:</p>
empty bracket notation:</p>
<pre lang="bash"><code>npm pkg set contributors[].name='Foo' contributors[].name='Bar'
</code></pre>
<p>Its also possible to parse values as json prior to saving them to your
<p>It's also possible to parse values as json prior to saving them to your
<code>package.json</code> file, for example in order to set a <code>"private": true</code>
property:</p>
<pre lang="bash"><code>npm pkg set private=true --json
@ -278,7 +279,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
<p>If you dont have a clear idea of what you want to do, it is strongly
<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-prefix</title>
<style>
body {
@ -170,7 +171,7 @@ also specified.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-profile</title>
<style>
body {
@ -190,7 +191,7 @@ homepage, freenode, twitter, github</p>
</li>
<li>
<p><code>npm profile set password</code>: Change your password. This is interactive,
youll be prompted for your current password and a new password. Youll
you'll be prompted for your current password and a new password. You'll
also be prompted for an OTP if you have two-factor authentication
enabled.</p>
</li>
@ -199,7 +200,7 @@ enabled.</p>
authentication. Defaults to <code>auth-and-writes</code> mode. Modes are:</p>
<ul>
<li><code>auth-only</code>: Require an OTP when logging in or making changes to your
accounts authentication. The OTP will be required on both the website
account's authentication. The OTP will be required on both the website
and the command line.</li>
<li><code>auth-and-writes</code>: Requires an OTP at all the times <code>auth-only</code> does,
and also requires one when publishing a module, setting the <code>latest</code>
@ -218,7 +219,7 @@ dist-tag, or changing access via <code>npm access</code> and <code>npm owner</co
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -251,7 +252,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-prune</title>
<style>
body {
@ -148,10 +149,10 @@ npm command-line interface
<pre lang="bash"><code>npm prune [[&lt;@scope&gt;/]&lt;pkg&gt;...] [--production] [--dry-run] [--json]
</code></pre>
<h3 id="description">Description</h3>
<p>This command removes “extraneous” packages. If a package name is provided,
<p>This command removes "extraneous" packages. If a package name is provided,
then only packages matching one of the supplied names are removed.</p>
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
not listed as any packages dependency list.</p>
not listed as any package's dependency list.</p>
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
variable is set to <code>production</code>, this command will remove the packages
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
@ -159,9 +160,9 @@ specified in your <code>devDependencies</code>. Setting <code>--no-production</c
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
have made with <code>--dry-run</code>) are printed as a JSON object.</p>
<p>In normal operation, extraneous modules are pruned automatically, so youll
<p>In normal operation, extraneous modules are pruned automatically, so you'll
only need this command with the <code>--production</code> flag. However, in the real
world, operation is not always “normal”. When crashes or mistakes happen,
world, operation is not always "normal". When crashes or mistakes happen,
this command can help clean up any resulting garbage.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@ -169,9 +170,9 @@ this command can help clean up any resulting garbage.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -188,7 +189,7 @@ variable will be set to <code>'production'</code> for all lifecycle scripts.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-publish</title>
<style>
body {
@ -173,15 +174,15 @@ that <code>npm install &lt;name&gt;@&lt;tag&gt;</code> will install this version
<li>
<p><code>[--access &lt;public|restricted&gt;]</code>: Tells the registry whether this package
should be published as public or restricted. Only applies to scoped
packages, which default to <code>restricted</code>. If you dont have a paid
packages, which default to <code>restricted</code>. If you don't have a paid
account, you must publish with <code>--access public</code> to publish scoped
packages.</p>
</li>
<li>
<p><code>[--otp &lt;otpcode&gt;]</code>: If you have two-factor authentication enabled in
<code>auth-and-writes</code> mode then you can provide a code from your
authenticator with this. If you dont include this and youre running
from a TTY then youll be prompted.</p>
authenticator with this. If you don't include this and you're running
from a TTY then you'll be prompted.</p>
</li>
<li>
<p><code>[--dry-run]</code>: As of <code>npm@6</code>, does everything publish would do except
@ -219,7 +220,7 @@ are always included. For example, <code>package.json</code>, <code>README.md</c
<code>LICENSE</code>, and so on.</p>
</li>
<li>
<p>If there is a “files” list in
<p>If there is a "files" list in
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>, then only the files
specified will be included. (If directories are specified, then they
will be walked recursively and their contents included, subject to the
@ -243,7 +244,7 @@ un-ignored with a <code>!</code> rule in a <code>.npmignore</code> or <code>.git
<p>Symbolic links are never included in npm packages.</p>
</li>
</ul>
<p>See <a href="../using-npm/developers.html"><code>developers</code></a> for full details on whats
<p>See <a href="../using-npm/developers.html"><code>developers</code></a> for full details on what's
included in the published package, as well as details on how the package is
built.</p>
<h3 id="configuration">Configuration</h3>
@ -252,10 +253,10 @@ built.</p>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
<li>Default: “latest”</li>
<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
<p>If you ask npm to install a package and dont tell it a specific version,
<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>
@ -265,8 +266,8 @@ tarball that will be compared with the local files by default.</p>
<!-- raw HTML omitted -->
<h4 id="access"><code>access</code></h4>
<ul>
<li>Default: restricted for scoped packages, public for unscoped packages</li>
<li>Type: null, “restricted”, or “public”</li>
<li>Default: 'restricted' for scoped packages, 'public' for unscoped packages</li>
<li>Type: null, "restricted", or "public"</li>
</ul>
<p>When publishing scoped packages, the access level defaults to <code>restricted</code>.
If you want your scoped package to be publicly viewable (and installable)
@ -284,7 +285,7 @@ initial publish use <code>npm access</code>.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -297,7 +298,7 @@ commands that modify your local installation, eg, <code>install</code>, <code>up
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-rebuild</title>
<style>
body {
@ -167,7 +168,7 @@ will be rebuilt.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -186,7 +187,7 @@ of the current working directory.</li>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-repo</title>
<style>
body {
@ -148,7 +149,7 @@ npm command-line interface
<pre lang="bash"><code>npm repo [&lt;pkgname&gt; [&lt;pkgname&gt; ...]]
</code></pre>
<h3 id="description">Description</h3>
<p>This command tries to guess at the likely location of a packages
<p>This command tries to guess at the likely location of a package's
repository URL, and then tries to open it using the <code>--browser</code> config
param. If no package name is provided, it will search for a <code>package.json</code>
in the current folder and use the <code>repository</code> property.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-restart</title>
<style>
body {
@ -186,7 +187,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-root</title>
<style>
body {
@ -164,7 +165,7 @@ echo "Global packages installed in: ${global_node_modules}"
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-run-script</title>
<style>
body {
@ -152,11 +153,11 @@ npm run-script &lt;command&gt; [--workspaces]
aliases: run, rum, urn
</code></pre>
<h3 id="description">Description</h3>
<p>This runs an arbitrary command from a packages <code>"scripts"</code> object. If no
<p>This runs an arbitrary command from a package's <code>"scripts"</code> object. If no
<code>"command"</code> is provided, it will list the available scripts.</p>
<p><code>run[-script]</code> is used by the test, start, restart, and stop commands, but
can be called directly, as well. When the scripts in the package are
printed out, theyre separated into lifecycle (test, start, restart) and
printed out, they're separated into lifecycle (test, start, restart) and
directly-run scripts.</p>
<p>Any positional arguments are passed to the specified script. Use <code>--</code> to
pass <code>-</code>-prefixed flags and options which would otherwise be parsed by npm.</p>
@ -167,9 +168,9 @@ pass <code>-</code>-prefixed flags and options which would otherwise be parsed b
and not to any <code>pre</code> or <code>post</code> script.</p>
<p>The <code>env</code> script is a special built-in command that can be used to list
environment variables that will be available to the script at runtime. If an
“env” command is defined in your package, it will take precedence over the
"env" command is defined in your package, it will take precedence over the
built-in.</p>
<p>In addition to the shells pre-existing <code>PATH</code>, <code>npm run</code> adds
<p>In addition to the shell's pre-existing <code>PATH</code>, <code>npm run</code> adds
<code>node_modules/.bin</code> to the <code>PATH</code> provided to scripts. Any binaries
provided by locally-installed dependencies can be used without the
<code>node_modules/.bin</code> prefix. For example, if there is a <code>devDependency</code> on
@ -186,17 +187,17 @@ The actual shell referred to by <code>/bin/sh</code> also depends on the system.
You can customize the shell with the <code>script-shell</code> configuration.</p>
<p>Scripts are run from the root of the package folder, regardless of what the
current working directory is when <code>npm run</code> is called. If you want your
script to use different behavior based on what subdirectory youre in, you
script to use different behavior based on what subdirectory you're in, you
can use the <code>INIT_CWD</code> environment variable, which holds the full path you
were in when you ran <code>npm run</code>.</p>
<p><code>npm run</code> sets the <code>NODE</code> environment variable to the <code>node</code> executable
with which <code>npm</code> is executed.</p>
<p>If you try to run a script without having a <code>node_modules</code> directory and it
fails, you will be given a warning to run <code>npm install</code>, just in case youve
fails, you will be given a warning to run <code>npm install</code>, just in case you've
forgotten.</p>
<h3 id="workspaces-support">Workspaces support</h3>
<p>You may use the <code>workspace</code> or <code>workspaces</code> configs in order to run an
arbitrary command from a packages <code>"scripts"</code> object in the context of the
arbitrary command from a package's <code>"scripts"</code> object in the context of the
specified workspaces. If no <code>"command"</code> is provided, it will list the available
scripts for each of these configured workspaces.</p>
<p>Given a project with configured workspaces, e.g:</p>
@ -221,7 +222,7 @@ we can run tests in all of them using the <code>workspaces</code> config:</p>
<pre><code>npm test --workspaces
</code></pre>
<h4 id="filtering-workspaces">Filtering workspaces</h4>
<p>Its also possible to run a script in a single workspace using the <code>workspace</code>
<p>It's also possible to run a script in a single workspace using the <code>workspace</code>
config along with a name or directory path:</p>
<pre><code>npm test --workspace=a
</code></pre>
@ -293,9 +294,9 @@ the specified workspaces, and not on the root project.</p>
<li>Type: Boolean</li>
</ul>
<p>If true, npm will not exit with an error code when <code>run-script</code> is invoked
for a script that isnt defined in the <code>scripts</code> section of <code>package.json</code>.
This option can be used when its desirable to optionally run a script when
its present and fail if the script fails. This is useful, for example, when
for a script that isn't defined in the <code>scripts</code> section of <code>package.json</code>.
This option can be used when it's desirable to optionally run a script when
it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.</p>
<!-- raw HTML omitted -->
@ -314,7 +315,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-search</title>
<style>
body {
@ -164,7 +165,7 @@ use them more fine-grained filtering. Additionally, you can add both of
these to your config to change default search filtering behavior.</p>
<p>Search also allows targeting of maintainers in search results, by prefixing
their npm username with <code>=</code>.</p>
<p>If a term starts with <code>/</code>, then its interpreted as a regular expression
<p>If a term starts with <code>/</code>, then it's interpreted as a regular expression
and supports standard JavaScript RegExp syntax. In this case search will
ignore a trailing <code>/</code> . (Note you must escape or quote many regular
expression characters in most shells.)</p>
@ -195,8 +196,8 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="color"><code>color</code></h4>
<ul>
<li>Default: true unless the NO_COLOR environ is set to something other than 0</li>
<li>Type: “always” or Boolean</li>
<li>Default: true unless the NO_COLOR environ is set to something other than '0'</li>
<li>Type: "always" or Boolean</li>
</ul>
<p>If false, never shows colors. If <code>"always"</code> then always shows colors. If
true, then only prints color codes for tty file descriptors.</p>
@ -221,7 +222,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="searchopts"><code>searchopts</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that are always passed to search.</p>
@ -229,7 +230,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="searchexclude"><code>searchexclude</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that limit the results from search.</p>
@ -237,7 +238,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-set-script</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-shrinkwrap</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-star</title>
<style>
body {
@ -149,14 +150,14 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>“Starring” a package means that you have some interest in it. Its
<p>"Starring" a package means that you have some interest in it. It's
a vaguely positive way to show that you care.</p>
<p>Its a boolean thing. Starring repeatedly has no additional effect.</p>
<p>It's a boolean thing. Starring repeatedly has no additional effect.</p>
<h3 id="more">More</h3>
<p>Theres also these extra commands to help you manage your favorite packages:</p>
<p>There's also these extra commands to help you manage your favorite packages:</p>
<h4 id="unstar">Unstar</h4>
<p>You can also “unstar” a package using <a href="../commands/npm-unstar.html"><code>npm unstar</code></a></p>
<p>“Unstarring” is the same thing, but in reverse.</p>
<p>You can also "unstar" a package using <a href="../commands/npm-unstar.html"><code>npm unstar</code></a></p>
<p>"Unstarring" is the same thing, but in reverse.</p>
<h4 id="listing-stars">Listing stars</h4>
<p>You can see all your starred packages using <a href="../commands/npm-stars.html"><code>npm stars</code></a></p>
<h3 id="configuration">Configuration</h3>
@ -165,7 +166,7 @@ a vaguely positive way to show that you care.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-stars</title>
<style>
body {
@ -151,7 +152,7 @@ npm command-line interface
<h3 id="description">Description</h3>
<p>If you have starred a lot of neat things and want to find them again
quickly this command lets you do just that.</p>
<p>You may also want to see your friends favorite packages, in this case
<p>You may also want to see your friend's favorite packages, in this case
you will most certainly enjoy this command.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@ -159,7 +160,7 @@ you will most certainly enjoy this command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-start</title>
<style>
body {
@ -149,11 +150,11 @@ npm command-line interface
</code></pre>
<h3 id="description">Description</h3>
<p>This runs a predefined command specified in the <code>"start"</code> property of
a packages <code>"scripts"</code> object.</p>
a package's <code>"scripts"</code> object.</p>
<p>If the <code>"scripts"</code> object does not define a <code>"start"</code> property, npm
will run <code>node server.js</code>.</p>
<p>Note that this is different from the default node behavior of running
the file specified in a packages <code>"main"</code> attribute when evoking with
the file specified in a package's <code>"main"</code> attribute when evoking with
<code>node .</code></p>
<p>As of <a href="https://blog.npmjs.org/post/98131109725/npm-2-0-0"><code>npm@2.0.0</code></a>, you can
use custom arguments when executing scripts. Refer to <a href="../commands/npm-run-script.html"><code>npm run-script</code></a> for more details.</p>
@ -190,7 +191,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-stop</title>
<style>
body {
@ -148,8 +149,8 @@ npm command-line interface
<pre lang="bash"><code>npm stop [-- &lt;args&gt;]
</code></pre>
<h3 id="description">Description</h3>
<p>This runs a predefined command specified in the “stop” property of a
packages “scripts” object.</p>
<p>This runs a predefined command specified in the "stop" property of a
package's "scripts" object.</p>
<p>Unlike with <a href="../commands/npm-start.html">npm start</a>, there is no default script
that will run if the <code>"stop"</code> property is not defined.</p>
<h3 id="example">Example</h3>
@ -185,7 +186,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-team</title>
<style>
body {
@ -163,13 +164,13 @@ when operating on them, separated by a colon (<code>:</code>). That is, if you h
as <code>@org:newteam</code> in these commands.</p>
<p>If you have two-factor authentication enabled in <code>auth-and-writes</code> mode, then
you can provide a code from your authenticator with <code>[--otp &lt;otpcode&gt;]</code>.
If you dont include this then you will be prompted.</p>
If you don't include this then you will be prompted.</p>
<ul>
<li>
<p>create / destroy:
Create a new team, or destroy an existing one. Note: You cannot remove the
<code>developers</code> team, <!-- raw HTML omitted -->learn more.<!-- raw HTML omitted --></p>
<p>Heres how to create a new team <code>newteam</code> under the <code>org</code> org:</p>
<p>Here's how to create a new team <code>newteam</code> under the <code>org</code> org:</p>
<pre lang="bash"><code>npm team create @org:newteam
</code></pre>
<p>You should see a confirming message such as: <code>+@org:newteam</code> once the new
@ -186,7 +187,7 @@ Add a user to an existing team.</p>
<li>
<p>rm:
Using <code>npm team rm</code> you can also remove users from a team they belong to.</p>
<p>Heres an example removing user <code>username</code> from <code>newteam</code> team
<p>Here's an example removing user <code>username</code> from <code>newteam</code> team
in <code>org</code> organization:</p>
<pre lang="bash"><code>npm team rm @org:newteam username
</code></pre>
@ -198,7 +199,7 @@ in <code>org</code> organization:</p>
If performed on an organization name, will return a list of existing teams
under that organization. If performed on a team, it will instead return a list
of all users belonging to that particular team.</p>
<p>Heres an example of how to list all teams from an org named <code>org</code>:</p>
<p>Here's an example of how to list all teams from an org named <code>org</code>:</p>
<pre lang="bash"><code>npm team ls @org
</code></pre>
<p>Example listing all members of a team named <code>newteam</code>:</p>
@ -222,7 +223,7 @@ use the <code>npm access</code> command to grant or revoke the appropriate permi
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -233,7 +234,7 @@ use the <code>npm access</code> command to grant or revoke the appropriate permi
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-test</title>
<style>
body {
@ -151,7 +152,7 @@ aliases: t, tst
</code></pre>
<h3 id="description">Description</h3>
<p>This runs a predefined command specified in the <code>"test"</code> property of
a packages <code>"scripts"</code> object.</p>
a package's <code>"scripts"</code> object.</p>
<h3 id="example">Example</h3>
<pre lang="json"><code>{
"scripts": {
@ -183,7 +184,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-token</title>
<style>
body {
@ -233,7 +234,7 @@ tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -244,7 +245,7 @@ tokens with the <code>npm token create</code> command.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-uninstall</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-unpublish</title>
<style>
body {
@ -161,7 +162,7 @@ want to maintain a package.</p>
removing the tarball.</p>
<p>The npm registry will return an error if you are not <a href="../commands/npm-adduser.html">logged
in</a>.</p>
<p>If you do not specify a version or if you remove all of a packages
<p>If you do not specify a version or if you remove all of a package's
versions then the registry will remove the root package entry entirely.</p>
<p>Even if you unpublish a package version, that specific name and version
combination can never be reused. In order to publish the package again,
@ -177,7 +178,7 @@ passed.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -207,7 +208,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
<p>If you dont have a clear idea of what you want to do, it is strongly
<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-unstar</title>
<style>
body {
@ -149,12 +150,12 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>“Unstarring” a package is the opposite of <a href="../commands/npm-star.html"><code>npm star</code></a>,
<p>"Unstarring" a package is the opposite of <a href="../commands/npm-star.html"><code>npm star</code></a>,
it removes an item from your list of favorite packages.</p>
<h3 id="more">More</h3>
<p>Theres also these extra commands to help you manage your favorite packages:</p>
<p>There's also these extra commands to help you manage your favorite packages:</p>
<h4 id="star">Star</h4>
<p>You can “star” a package using <a href="../commands/npm-star.html"><code>npm star</code></a></p>
<p>You can "star" a package using <a href="../commands/npm-star.html"><code>npm star</code></a></p>
<h4 id="listing-stars">Listing stars</h4>
<p>You can see all your starred packages using <a href="../commands/npm-stars.html"><code>npm stars</code></a></p>
<h3 id="configuration">Configuration</h3>
@ -163,7 +164,7 @@ it removes an item from your list of favorite packages.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -184,7 +185,7 @@ false, it uses ascii characters instead of unicode glyphs.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-update</title>
<style>
body {
@ -179,7 +180,7 @@ are:</p>
}
</code></pre>
<h4 id="caret-dependencies">Caret Dependencies</h4>
<p>If <code>app</code>s <code>package.json</code> contains:</p>
<p>If <code>app</code>'s <code>package.json</code> contains:</p>
<pre lang="json"><code>"dependencies": {
"dep1": "^1.1.1"
}
@ -187,7 +188,7 @@ are:</p>
<p>Then <code>npm update</code> will install <code>dep1@1.2.2</code>, because <code>1.2.2</code> is <code>latest</code> and
<code>1.2.2</code> satisfies <code>^1.1.1</code>.</p>
<h4 id="tilde-dependencies">Tilde Dependencies</h4>
<p>However, if <code>app</code>s <code>package.json</code> contains:</p>
<p>However, if <code>app</code>'s <code>package.json</code> contains:</p>
<pre lang="json"><code>"dependencies": {
"dep1": "~1.1.1"
}
@ -237,7 +238,7 @@ In this case if you really did need your package to use a newer version
you would need to use <code>npm install</code>.</p>
<h4 id="updating-globally-installed-packages">Updating Globally-Installed Packages</h4>
<p><code>npm update -g</code> will apply the <code>update</code> action to each globally installed
package that is <code>outdated</code> that is, has a version that is different from
package that is <code>outdated</code> -- that is, has a version that is different from
<code>wanted</code>.</p>
<p>Note: Globally installed packages are treated as if they are installed with a
caret semver range specified. So if you require to update to <code>latest</code> you may
@ -253,7 +254,7 @@ be <em>downgraded</em>.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -300,7 +301,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -320,9 +321,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -351,7 +352,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -365,7 +366,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -374,7 +375,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -383,7 +384,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-version</title>
<style>
body {
@ -195,10 +196,10 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="preid"><code>preid</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>The “prerelease identifier” to use as a prefix for the “prerelease” part of
<p>The "prerelease identifier" to use as a prefix for the "prerelease" part of
a semver. Like the <code>rc</code> in <code>1.2.0-rc.8</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-view</title>
<style>
body {
@ -184,7 +185,7 @@ For example, to get all the contributor names and email addresses, you
can do this:</p>
<pre lang="bash"><code>npm view express contributors.name contributors.email
</code></pre>
<p>“Person” fields are shown as a string if they would be shown as an
<p>"Person" fields are shown as a string if they would be shown as an
object. So, for example, this will show the list of <code>npm</code> contributors in
the shortened string format. (See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for more on this.)</p>
<pre lang="bash"><code>npm view npm contributors

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-whoami</title>
<style>
body {
@ -161,7 +162,7 @@ associated with the token, and print to standard output.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm</title>
<style>
body {
@ -148,7 +149,7 @@ npm command-line interface
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>8.1.3</p>
<p>8.1.4</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
@ -158,22 +159,22 @@ commonly, you use it to publish, discover, install, and develop node
programs.</p>
<p>Run <code>npm help</code> to get a list of available commands.</p>
<h3 id="important">Important</h3>
<p>npm comes preconfigured to use npms public registry at
<p>npm comes preconfigured to use npm's public registry at
<a href="https://registry.npmjs.org">https://registry.npmjs.org</a> by default. Use of the npm public registry is
subject to terms of use available at
<a href="https://docs.npmjs.com/policies/terms">https://docs.npmjs.com/policies/terms</a>.</p>
<p>You can configure npm to use any compatible registry you like, and even
run your own registry. Use of someone elses registry is governed by
run your own registry. Use of someone else's registry is governed by
their terms of use.</p>
<h3 id="introduction">Introduction</h3>
<p>You probably got npm because you want to install stuff.</p>
<p>The very first thing you will most likely want to run in any node
program is <code>npm install</code> to install its dependencies.</p>
<p>You can also run <code>npm install blerg</code> to install the latest version of
“blerg”. Check out <a href="../commands/npm-install.html"><code>npm install</code></a> for more
"blerg". Check out <a href="../commands/npm-install.html"><code>npm install</code></a> for more
info. It can do a lot of stuff.</p>
<p>Use the <code>npm search</code> command to show everything thats available in the
public registry. Use <code>npm ls</code> to show everything youve installed.</p>
<p>Use the <code>npm search</code> command to show everything that's available in the
public registry. Use <code>npm ls</code> to show everything you've installed.</p>
<h3 id="dependencies">Dependencies</h3>
<p>If a package lists a dependency using a git URL, npm will install that
dependency using the <a href="https://github.com/git-guides/install-git"><code>git</code></a>
@ -203,17 +204,17 @@ npm installs packages into the install prefix at
<p>Local mode is the default. Use <code>-g</code> or <code>--global</code> on any command to
run in global mode instead.</p>
<h3 id="developer-usage">Developer Usage</h3>
<p>If youre using npm to develop and publish your code, check out the
<p>If you're using npm to develop and publish your code, check out the
following help topics:</p>
<ul>
<li>json:
Make a package.json file. See
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>.</li>
<li>link:
Links your current working code into Nodes path, so that you dont
Links your current working code into Node's path, so that you don't
have to reinstall every time you make a change. Use <a href="../commands/npm-link.html"><code>npm link</code></a> to do this.</li>
<li>install:
Its a good idea to install things if you dont need the symbolic
It's a good idea to install things if you don't need the symbolic
link. Especially, installing other peoples code from the registry is
done via <a href="../commands/npm-install.html"><code>npm install</code></a></li>
<li>adduser:
@ -229,7 +230,7 @@ code to the registry.</li>
<ul>
<li>Command line switches:
Set a config with <code>--key val</code>. All keys take a value, even if they
are booleans (the config parser doesnt know what the options are at
are booleans (the config parser doesn't know what the options are at
the time of parsing). If you do not provide a value (<code>--key</code>) then
the option is set to boolean <code>true</code>.</li>
<li>Environment Variables:
@ -245,13 +246,13 @@ parsed if it is found. See <a href="../commands/npm-prefix.html"><code>npm pref
more info on the global prefix. If the <code>globalconfig</code> option is set
in the cli, env, or user config, then that file is parsed instead.</li>
<li>Defaults:
npms default configuration options are defined in
npm's default configuration options are defined in
lib/utils/config-defs.js. These must not be changed.</li>
</ul>
<p>See <a href="../using-npm/config.html"><code>config</code></a> for much much more information.</p>
<h3 id="contributions">Contributions</h3>
<p>Patches welcome!</p>
<p>If you would like to help, but dont know what to work on, read the
<p>If you would like to help, but don't know what to work on, read the
<a href="https://github.com/npm/cli/blob/latest/CONTRIBUTING.md">contributing
guidelines</a> and
check the issues list.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npx</title>
<style>
body {
@ -200,7 +201,7 @@ the first command argument.</p>
<h3 id="npx-vs-npm-exec"><code>npx</code> vs <code>npm exec</code></h3>
<p>When run via the <code>npx</code> binary, all flags and options <em>must</em> be set prior to
any positional arguments. When run via <code>npm exec</code>, a double-hyphen <code>--</code>
flag can be used to suppress npms parsing of switches and options that
flag can be used to suppress npm's parsing of switches and options that
should be sent to the executed command.</p>
<p>For example:</p>
<pre><code>$ npx foo@latest bar --package=@npmcli/foo
@ -211,7 +212,7 @@ following command:</p>
</code></pre>
<p>Since the <code>--package</code> option comes <em>after</em> the positional arguments, it is
treated as an argument to the executed command.</p>
<p>In contrast, due to npms argument parsing logic, running this command is
<p>In contrast, due to npm's argument parsing logic, running this command is
different:</p>
<pre><code>$ npm exec foo@latest bar --package=@npmcli/foo
</code></pre>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>folders</title>
<style>
body {
@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
<p>npm puts various things on your computer. Thats its job.</p>
<p>npm puts various things on your computer. That's its job.</p>
<p>This document will tell you what it puts where.</p>
<h4 id="tldr">tl;dr</h4>
<ul>
@ -153,14 +154,14 @@ npm command-line interface
package root.</li>
<li>Global install (with <code>-g</code>): puts stuff in /usr/local or wherever node
is installed.</li>
<li>Install it <strong>locally</strong> if youre going to <code>require()</code> it.</li>
<li>Install it <strong>globally</strong> if youre going to run it on the command line.</li>
<li>Install it <strong>locally</strong> if you're going to <code>require()</code> it.</li>
<li>Install it <strong>globally</strong> if you're going to run it on the command line.</li>
<li>If you need both, then install it in both places, or use <code>npm link</code>.</li>
</ul>
<h4 id="prefix-configuration">prefix Configuration</h4>
<p>The <code>prefix</code> config defaults to the location where node is installed.
On most systems, this is <code>/usr/local</code>. On Windows, its <code>%AppData%\npm</code>.
On Unix systems, its one level up, since node is typically installed at
On most systems, this is <code>/usr/local</code>. On Windows, it's <code>%AppData%\npm</code>.
On Unix systems, it's one level up, since node is typically installed at
<code>{prefix}/bin/node</code> rather than <code>{prefix}/node.exe</code>.</p>
<p>When the <code>global</code> flag is set, npm installs things into this prefix.
When it is not set, it uses the root of the current package, or the
@ -182,7 +183,7 @@ the package in <code>{prefix}/node_modules/@myorg/package</code>. See
<h4 id="executables">Executables</h4>
<p>When in global mode, executables are linked into <code>{prefix}/bin</code> on Unix,
or directly into <code>{prefix}</code> on Windows. Ensure that path is in your
terminals <code>PATH</code> environment to run them.</p>
terminal's <code>PATH</code> environment to run them.</p>
<p>When in local mode, executables are linked into
<code>./node_modules/.bin</code> so that they can be made available to scripts run
through npm. (For example, so that a test runner will be in the path
@ -209,41 +210,41 @@ into some other folder.</p>
<p>Starting at the $PWD, npm will walk up the folder tree checking for a
folder that contains either a <code>package.json</code> file, or a <code>node_modules</code>
folder. If such a thing is found, then that is treated as the effective
“current directory” for the purpose of running npm commands. (This
behavior is inspired by and similar to gits .git-folder seeking
"current directory" for the purpose of running npm commands. (This
behavior is inspired by and similar to git's .git-folder seeking
logic when running git commands in a working dir.)</p>
<p>If no package root is found, then the current folder is used.</p>
<p>When you run <code>npm install foo@1.2.3</code>, then the package is loaded into
the cache, and then unpacked into <code>./node_modules/foo</code>. Then, any of
foos dependencies are similarly unpacked into
foo's dependencies are similarly unpacked into
<code>./node_modules/foo/node_modules/...</code>.</p>
<p>Any bin files are symlinked to <code>./node_modules/.bin/</code>, so that they may
be found by npm scripts when necessary.</p>
<h4 id="global-installation">Global Installation</h4>
<p>If the <code>global</code> configuration is set to true, then npm will
install packages “globally”.</p>
install packages "globally".</p>
<p>For global installation, packages are installed roughly the same way,
but using the folders described above.</p>
<h4 id="cycles-conflicts-and-folder-parsimony">Cycles, Conflicts, and Folder Parsimony</h4>
<p>Cycles are handled using the property of nodes module system that it
<p>Cycles are handled using the property of node's module system that it
walks up the directories looking for <code>node_modules</code> folders. So, at every
stage, if a package is already installed in an ancestor <code>node_modules</code>
folder, then it is not installed at the current location.</p>
<p>Consider the case above, where <code>foo -&gt; bar -&gt; baz</code>. Imagine if, in
addition to that, baz depended on bar, so youd have:
addition to that, baz depended on bar, so you'd have:
<code>foo -&gt; bar -&gt; baz -&gt; bar -&gt; baz ...</code>. However, since the folder
structure is: <code>foo/node_modules/bar/node_modules/baz</code>, theres no need to
structure is: <code>foo/node_modules/bar/node_modules/baz</code>, there's no need to
put another copy of bar into <code>.../baz/node_modules</code>, since when it calls
require(“bar”), it will get the copy that is installed in
require("bar"), it will get the copy that is installed in
<code>foo/node_modules/bar</code>.</p>
<p>This shortcut is only used if the exact same
version would be installed in multiple nested <code>node_modules</code> folders. It
is still possible to have <code>a/node_modules/b/node_modules/a</code> if the two
“a” packages are different versions. However, without repeating the
"a" packages are different versions. However, without repeating the
exact same package multiple times, an infinite regress will always be
prevented.</p>
<p>Another optimization can be made by installing dependencies at the
highest level possible, below the localized “target” folder.</p>
highest level possible, below the localized "target" folder.</p>
<h4 id="example">Example</h4>
<p>Consider this dependency graph:</p>
<pre lang="bash"><code>foo
@ -273,19 +274,19 @@ highest level possible, below the localized “target” folder.</p>
`-- quux (3.2.0) &lt;---[E]
</code></pre>
<p>Since foo depends directly on <code>bar@1.2.3</code> and <code>baz@1.2.3</code>, those are
installed in foos <code>node_modules</code> folder.</p>
installed in foo's <code>node_modules</code> folder.</p>
<p>Even though the latest copy of blerg is 1.3.7, foo has a specific
dependency on version 1.2.5. So, that gets installed at [A]. Since the
parent installation of blerg satisfies bars dependency on <code>blerg@1.x</code>,
parent installation of blerg satisfies bar's dependency on <code>blerg@1.x</code>,
it does not install another copy under [B].</p>
<p>Bar [B] also has dependencies on baz and asdf, so those are installed in
bars <code>node_modules</code> folder. Because it depends on <code>baz@2.x</code>, it cannot
bar's <code>node_modules</code> folder. Because it depends on <code>baz@2.x</code>, it cannot
re-use the <code>baz@1.2.3</code> installed in the parent <code>node_modules</code> folder [D],
and must install its own copy [C].</p>
<p>Underneath bar, the <code>baz -&gt; quux -&gt; bar</code> dependency creates a cycle.
However, because bar is already in quuxs ancestry [B], it does not
However, because bar is already in quux's ancestry [B], it does not
unpack another copy of bar into that folder.</p>
<p>Underneath <code>foo -&gt; baz</code> [D], quuxs [E] folder tree is empty, because its
<p>Underneath <code>foo -&gt; baz</code> [D], quux's [E] folder tree is empty, because its
dependency on bar is satisfied by the parent folder copy installed at [B].</p>
<p>For a graphical breakdown of what is installed where, use <code>npm ls</code>.</p>
<h4 id="publishing">Publishing</h4>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>install</title>
<style>
body {
@ -191,12 +192,12 @@ installer to install both Node.js and npm on your system.</p>
you use Linux, we recommend that you use a NodeSource installer.</li>
</ul>
<h4 id="os-x-or-windows-node-installers">OS X or Windows Node installers</h4>
<p>If youre using OS X or Windows, use one of the installers from the
<p>If you're using OS X or Windows, use one of the installers from the
<a href="https://nodejs.org/en/download/">Node.js download page</a>. Be sure to
install the version labeled <strong>LTS</strong>. Other versions have not yet been
tested with npm.</p>
<h4 id="linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</h4>
<p>If youre using Linux or another operating system, use one of the following
<p>If you're using Linux or another operating system, use one of the following
installers:</p>
<ul>
<li><a href="https://github.com/nodesource/distributions">NodeSource installer</a>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npm-shrinkwrap.json</title>
<style>
body {
@ -150,7 +151,7 @@ npm command-line interface
<code>npm-shrinkwrap.json</code> may be included when publishing a package.</p>
<p>The recommended use-case for <code>npm-shrinkwrap.json</code> is applications deployed
through the publishing process on the registry: for example, daemons and
command-line tools intended as global installs or <code>devDependencies</code>. Its
command-line tools intended as global installs or <code>devDependencies</code>. It's
strongly discouraged for library authors to publish this file, since that
would prevent end users from having control over transitive dependency
updates.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>npmrc</title>
<style>
body {
@ -167,7 +168,7 @@ example:</p>
<p>Each of these files is loaded, and config options are resolved in priority
order. For example, a setting in the userconfig file would override the
setting in the globalconfig file.</p>
<p>Array values are specified by adding “[]” after the key name. For example:</p>
<p>Array values are specified by adding "[]" after the key name. For example:</p>
<pre lang="bash"><code>key[] = "first value"
key[] = "second value"
</code></pre>
@ -184,9 +185,9 @@ key[] = "second value"
<p>When working locally in a project, a <code>.npmrc</code> file in the root of the
project (ie, a sibling of <code>node_modules</code> and <code>package.json</code>) will set
config values specific to this project.</p>
<p>Note that this only applies to the root of the project that youre running
<p>Note that this only applies to the root of the project that you're running
npm in. It has no effect when your module is published. For example, you
cant publish a module that forces itself to install globally, or in a
can't publish a module that forces itself to install globally, or in a
different location.</p>
<p>Additionally, this file is not read in global mode, such as when running
<code>npm install -g</code>.</p>
@ -199,7 +200,7 @@ is an ini-file formatted list of <code>key = value</code> parameters. Environme
variables can be replaced as above.</p>
<h4 id="built-in-config-file">Built-in config file</h4>
<p><code>path/to/npm/itself/npmrc</code></p>
<p>This is an unchangeable “builtin” configuration file that npm keeps
<p>This is an unchangeable "builtin" configuration file that npm keeps
consistent across updates. Set fields in here using the <code>./configure</code>
script that comes with npm. This is primarily for distribution maintainers
to override default configs in a standard and consistent manner.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>package.json</title>
<style>
body {
@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
<p>This document is all you need to know about whats required in your
<p>This document is all you need to know about what's required in your
package.json file. It must be actual JSON, not just a JavaScript object
literal.</p>
<p>A lot of the behavior described in this document is affected by the config
@ -155,7 +156,7 @@ settings described in <a href="../using-npm/config.html"><code>config</code></a>
package.json are the name and version fields as they will be required. The
name and version together form an identifier that is assumed to be
completely unique. Changes to the package should come along with changes
to the version. If you dont plan to publish your package, the name and
to the version. If you don't plan to publish your package, the name and
version fields are optional.</p>
<p>The name is what your thing is called.</p>
<p>Some rules:</p>
@ -166,18 +167,18 @@ scope for scoped packages.</li>
is not permitted without a scope.</li>
<li>New packages must not have uppercase letters in the name.</li>
<li>The name ends up being part of a URL, an argument on the command line,
and a folder name. Therefore, the name cant contain any non-URL-safe
and a folder name. Therefore, the name can't contain any non-URL-safe
characters.</li>
</ul>
<p>Some tips:</p>
<ul>
<li>Dont use the same name as a core Node module.</li>
<li>Dont put “js” or “node” in the name. Its assumed that its js, since
youre writing a package.json file, and you can specify the engine using
the “engines” field. (See below.)</li>
<li>Don't use the same name as a core Node module.</li>
<li>Don't put "js" or "node" in the name. It's assumed that it's js, since
you're writing a package.json file, and you can specify the engine using
the "engines" field. (See below.)</li>
<li>The name will probably be passed as an argument to require(), so it
should be something short, but also reasonably descriptive.</li>
<li>You may want to check the npm registry to see if theres something by
<li>You may want to check the npm registry to see if there's something by
that name already, before you get too attached to it.
<a href="https://www.npmjs.com/">https://www.npmjs.com/</a></li>
</ul>
@ -188,24 +189,24 @@ that name already, before you get too attached to it.
package.json are the name and version fields as they will be required. The
name and version together form an identifier that is assumed to be
completely unique. Changes to the package should come along with changes
to the version. If you dont plan to publish your package, the name and
to the version. If you don't plan to publish your package, the name and
version fields are optional.</p>
<p>Version must be parseable by
<a href="https://github.com/npm/node-semver">node-semver</a>, which is bundled with
npm as a dependency. (<code>npm install semver</code> to use it yourself.)</p>
<h3 id="description2">description</h3>
<p>Put a description in it. Its a string. This helps people discover your
package, as its listed in <code>npm search</code>.</p>
<p>Put a description in it. It's a string. This helps people discover your
package, as it's listed in <code>npm search</code>.</p>
<h3 id="keywords">keywords</h3>
<p>Put keywords in it. Its an array of strings. This helps people discover
your package as its listed in <code>npm search</code>.</p>
<p>Put keywords in it. It's an array of strings. This helps people discover
your package as it's listed in <code>npm search</code>.</p>
<h3 id="homepage">homepage</h3>
<p>The url to the project homepage.</p>
<p>Example:</p>
<pre lang="json"><code>"homepage": "https://github.com/owner/project#readme"
</code></pre>
<h3 id="bugs">bugs</h3>
<p>The url to your projects issue tracker and / or the email address to which
<p>The url to your project's issue tracker and / or the email address to which
issues should be reported. These are helpful for people who encounter
issues with your package.</p>
<p>It should look like this:</p>
@ -215,14 +216,14 @@ issues with your package.</p>
}
</code></pre>
<p>You can specify either one or both values. If you want to provide only a
url, you can specify the value for “bugs” as a simple string instead of an
url, you can specify the value for "bugs" as a simple string instead of an
object.</p>
<p>If a url is provided, it will be used by the <code>npm bugs</code> command.</p>
<h3 id="license">license</h3>
<p>You should specify a license for your package so that people know how they
are permitted to use it, and any restrictions youre placing on it.</p>
<p>If youre using a common license such as BSD-2-Clause or MIT, add a current
SPDX license identifier for the license youre using, like this:</p>
are permitted to use it, and any restrictions you're placing on it.</p>
<p>If you're using a common license such as BSD-2-Clause or MIT, add a current
SPDX license identifier for the license you're using, like this:</p>
<pre lang="json"><code>{
"license" : "BSD-3-Clause"
}
@ -237,14 +238,14 @@ string</a>, like this:</p>
"license" : "(ISC OR GPL-3.0)"
}
</code></pre>
<p>If you are using a license that hasnt been assigned an SPDX identifier, or if
<p>If you are using a license that hasn't been assigned an SPDX identifier, or if
you are using a custom license, use a string value like this one:</p>
<pre lang="json"><code>{
"license" : "SEE LICENSE IN &lt;filename&gt;"
}
</code></pre>
<p>Then include a file named <code>&lt;filename&gt;</code> at the top level of the package.</p>
<p>Some old packages used license objects or a “licenses” property containing
<p>Some old packages used license objects or a "licenses" property containing
an array of license objects:</p>
<pre lang="json"><code>// Not valid metadata
{
@ -285,8 +286,8 @@ unpublished package under any terms:</p>
</code></pre>
<p>Consider also setting <code>"private": true</code> to prevent accidental publication.</p>
<h3 id="people-fields-author-contributors">people fields: author, contributors</h3>
<p>The “author” is one person. “contributors” is an array of people. A
“person” is an object with a “name” field and optionally “url” and “email”,
<p>The "author" is one person. "contributors" is an array of people. A
"person" is an object with a "name" field and optionally "url" and "email",
like this:</p>
<pre lang="json"><code>{
"name" : "Barney Rubble",
@ -301,7 +302,7 @@ you:</p>
}
</code></pre>
<p>Both email and url are optional either way.</p>
<p>npm also sets a top-level “maintainers” field with your npm user info.</p>
<p>npm also sets a top-level "maintainers" field with your npm user info.</p>
<h3 id="funding">funding</h3>
<p>You can specify an object containing an URL that provides up-to-date
information about ways to help fund development of your package, or a
@ -342,24 +343,24 @@ be visited)</p>
entries to be included when your package is installed as a dependency. File
patterns follow a similar syntax to <code>.gitignore</code>, but reversed: including a
file, directory, or glob pattern (<code>*</code>, <code>**/*</code>, and such) will make it so
that file is included in the tarball when its packed. Omitting the field
that file is included in the tarball when it's packed. Omitting the field
will make it default to <code>["*"]</code>, which means it will include all files.</p>
<p>Some special files and directories are also included or excluded regardless
of whether they exist in the <code>files</code> array (see below).</p>
<p>You can also provide a <code>.npmignore</code> file in the root of your package or in
subdirectories, which will keep files from being included. At the root of
your package it will not override the “files” field, but in subdirectories
your package it will not override the "files" field, but in subdirectories
it will. The <code>.npmignore</code> file works just like a <code>.gitignore</code>. If there is
a <code>.gitignore</code> file, and <code>.npmignore</code> is missing, <code>.gitignore</code>s contents
a <code>.gitignore</code> file, and <code>.npmignore</code> is missing, <code>.gitignore</code>'s contents
will be used instead.</p>
<p>Files included with the “package.json#files” field <em>cannot</em> be excluded
<p>Files included with the "package.json#files" field <em>cannot</em> be excluded
through <code>.npmignore</code> or <code>.gitignore</code>.</p>
<p>Certain files are always included, regardless of settings:</p>
<ul>
<li><code>package.json</code></li>
<li><code>README</code></li>
<li><code>LICENSE</code> / <code>LICENCE</code></li>
<li>The file in the “main” field</li>
<li>The file in the "main" field</li>
</ul>
<p><code>README</code> &amp; <code>LICENSE</code> can have any case and extension.</p>
<p>Conversely, some files are always ignored:</p>
@ -385,7 +386,7 @@ it to be published)</li>
<h3 id="main">main</h3>
<p>The main field is a module ID that is the primary entry point to your
program. That is, if your package is named <code>foo</code>, and a user installs it,
and then does <code>require("foo")</code>, then your main modules exports object will
and then does <code>require("foo")</code>, then your main module's exports object will
be returned.</p>
<p>This should be a module relative to the root of your package folder.</p>
<p>For most modules, it makes the most sense to have a main script and often
@ -394,12 +395,12 @@ not much else.</p>
<h3 id="browser">browser</h3>
<p>If your module is meant to be used client-side the browser field should be
used instead of the main field. This is helpful to hint users that it might
rely on primitives that arent available in Node.js modules. (e.g.
rely on primitives that aren't available in Node.js modules. (e.g.
<code>window</code>)</p>
<h3 id="bin">bin</h3>
<p>A lot of packages have one or more executable files that theyd like to
<p>A lot of packages have one or more executable files that they'd like to
install into the PATH. npm makes this pretty easy (in fact, it uses this
feature to install the “npm” executable.)</p>
feature to install the "npm" executable.)</p>
<p>To use this, supply a <code>bin</code> field in your package.json which is a map of
command name to local file name. When this package is installed
globally, that file will be linked where global bins go so it is
@ -414,7 +415,7 @@ scripts when invoking them via <code>npm run-script</code>.</p>
}
}
</code></pre>
<p>So, when you install myapp, itll create a symlink from the <code>cli.js</code> script
<p>So, when you install myapp, it'll create a symlink from the <code>cli.js</code> script
to <code>/usr/local/bin/myapp</code>.</p>
<p>If you have a single executable, and its name should be the name of the
package, then you can just supply it as a string. For example:</p>
@ -442,7 +443,7 @@ executables.</p>
<h3 id="man">man</h3>
<p>Specify either a single file or an array of filenames to put in place for
the <code>man</code> program to find.</p>
<p>If only a single file is provided, then its installed such that it is the
<p>If only a single file is provided, then it's installed such that it is the
result from <code>man &lt;pkgname&gt;</code>, regardless of its actual filename. For
example:</p>
<pre lang="json"><code>{
@ -454,7 +455,7 @@ example:</p>
}
</code></pre>
<p>would link the <code>./man/doc.1</code> file in such that it is the target for <code>man foo</code></p>
<p>If the filename doesnt start with the package name, then its prefixed.
<p>If the filename doesn't start with the package name, then it's prefixed.
So, this:</p>
<pre lang="json"><code>{
"name": "foo",
@ -486,8 +487,8 @@ into.</p>
<h3 id="directories">directories</h3>
<p>The CommonJS <a href="http://wiki.commonjs.org/wiki/Packages/1.0">Packages</a> spec
details a few ways that you can indicate the structure of your package
using a <code>directories</code> object. If you look at <a href="https://registry.npmjs.org/npm/latest">npms
package.json</a>, youll see that it
using a <code>directories</code> object. If you look at <a href="https://registry.npmjs.org/npm/latest">npm's
package.json</a>, you'll see that it
has directories for doc, lib, and man.</p>
<p>In the future, this information may be used in other creative ways.</p>
<h4 id="directoriesbin">directories.bin</h4>
@ -498,7 +499,7 @@ and setting <code>directories.bin</code> is an error. If you want to specify
individual files, use <code>bin</code>, and for all the files in an existing <code>bin</code>
directory, use <code>directories.bin</code>.</p>
<h4 id="directoriesman">directories.man</h4>
<p>A folder that is full of man pages. Sugar to generate a “man” array by
<p>A folder that is full of man pages. Sugar to generate a "man" array by
walking the folder.</p>
<h3 id="repository">repository</h3>
<p>Specify the place where your code lives. This is helpful for people who
@ -514,7 +515,7 @@ command will be able to find you.</p>
</code></pre>
<p>The URL should be a publicly available (perhaps read-only) url that can be
handed directly to a VCS program without any modification. It should not
be a url to an html project page that you put in your browser. Its for
be a url to an html project page that you put in your browser. It's for
computers.</p>
<p>For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the
same shortcut syntax you use for <code>npm install</code>:</p>
@ -542,13 +543,13 @@ which it lives:</p>
}
</code></pre>
<h3 id="scripts">scripts</h3>
<p>The “scripts” property is a dictionary containing script commands that are
<p>The "scripts" property is a dictionary containing script commands that are
run at various times in the lifecycle of your package. The key is the
lifecycle event, and the value is the command to run at that point.</p>
<p>See <a href="../using-npm/scripts.html"><code>scripts</code></a> to find out more about writing package
scripts.</p>
<h3 id="config">config</h3>
<p>A “config” object can be used to set configuration parameters used in
<p>A "config" object can be used to set configuration parameters used in
package scripts that persist across upgrades. For instance, if a package
had the following:</p>
<pre lang="json"><code>{
@ -558,14 +559,14 @@ had the following:</p>
}
}
</code></pre>
<p>It could also have a “start” command that referenced the
<p>It could also have a "start" command that referenced the
<code>npm_package_config_port</code> environment variable.</p>
<h3 id="dependencies">dependencies</h3>
<p>Dependencies are specified in a simple object that maps a package name to a
version range. The version range is a string which has one or more
space-separated descriptors. Dependencies can also be identified with a
tarball or git URL.</p>
<p><strong>Please do not put test harnesses or transpilers or other “development”
<p><strong>Please do not put test harnesses or transpilers or other "development"
time tools in your <code>dependencies</code> object.</strong> See <code>devDependencies</code>, below.</p>
<p>See <a href="https://github.com/npm/node-semver#versions">semver</a> for more details about specifying version ranges.</p>
<ul>
@ -574,17 +575,17 @@ time tools in your <code>dependencies</code> object.</strong> See <code>devDepe
<li><code>&gt;=version</code> etc</li>
<li><code>&lt;version</code></li>
<li><code>&lt;=version</code></li>
<li><code>~version</code> “Approximately equivalent to version” See
<li><code>~version</code> "Approximately equivalent to version" See
<a href="https://github.com/npm/node-semver#versions">semver</a></li>
<li><code>^version</code> “Compatible with version” See <a href="https://github.com/npm/node-semver#versions">semver</a></li>
<li><code>^version</code> "Compatible with version" See <a href="https://github.com/npm/node-semver#versions">semver</a></li>
<li><code>1.2.x</code> 1.2.0, 1.2.1, etc., but not 1.3.0</li>
<li><code>http://...</code> See URLs as Dependencies below</li>
<li><code>http://...</code> See 'URLs as Dependencies' below</li>
<li><code>*</code> Matches any version</li>
<li><code>""</code> (just an empty string) Same as <code>*</code></li>
<li><code>version1 - version2</code> Same as <code>&gt;=version1 &lt;=version2</code>.</li>
<li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li>
<li><code>git...</code> See Git URLs as Dependencies below</li>
<li><code>user/repo</code> See GitHub URLs below</li>
<li><code>git...</code> See 'Git URLs as Dependencies' below</li>
<li><code>user/repo</code> See 'GitHub URLs' below</li>
<li><code>tag</code> A specific version tagged and published as <code>tag</code> See <a href="../commands/npm-dist-tag.html"><code>npm dist-tag</code></a></li>
<li><code>path/path/path</code> See <a href="#local-paths">Local Paths</a> below</li>
</ul>
@ -629,8 +630,8 @@ git+https://isaacs@github.com/npm/cli.git
git://github.com/npm/cli.git#v1.0.27
</code></pre>
<h4 id="github-urls">GitHub URLs</h4>
<p>As of version 1.1.65, you can refer to GitHub urls as just “foo”:
“user/foo-project”. Just as with git URLs, a <code>commit-ish</code> suffix can be
<p>As of version 1.1.65, you can refer to GitHub urls as just "foo":
"user/foo-project". Just as with git URLs, a <code>commit-ish</code> suffix can be
included. For example:</p>
<pre lang="json"><code>{
"name": "foo",
@ -660,13 +661,13 @@ contains a package. Local paths can be saved using <code>npm install -S</code> o
}
</code></pre>
<p>This feature is helpful for local offline development and creating tests
that require npm installing where you dont want to hit an external server,
that require npm installing where you don't want to hit an external server,
but should not be used when publishing packages to the public registry.</p>
<h3 id="devdependencies">devDependencies</h3>
<p>If someone is planning on downloading and using your module in their
program, then they probably dont want or need to download and build the
program, then they probably don't want or need to download and build the
external test or documentation framework that you use.</p>
<p>In this case, its best to map these additional items in a
<p>In this case, it's best to map these additional items in a
<code>devDependencies</code> object.</p>
<p>These things will be installed when doing <code>npm link</code> or <code>npm install</code> from
the root of a package, and can be managed like any other npm configuration
@ -690,7 +691,7 @@ do this, and make the required package a devDependency.</p>
</code></pre>
<p>The <code>prepare</code> script will be run before publishing, so that users can
consume the functionality without requiring them to compile it themselves.
In dev mode (ie, locally running <code>npm install</code>), itll run this script as
In dev mode (ie, locally running <code>npm install</code>), it'll run this script as
well, so that you can test it easily.</p>
<h3 id="peerdependencies">peerDependencies</h3>
<p>In some cases, you want to express the compatibility of your package with a
@ -721,7 +722,7 @@ an error if the tree cannot be resolved correctly. For this reason, make
sure your plugin requirement is as broad as possible, and not to lock it
down to specific patch versions.</p>
<p>Assuming the host complies with <a href="https://semver.org/">semver</a>, only changes
in the host packages major version will break your plugin. Thus, if youve
in the host package's major version will break your plugin. Thus, if you've
worked with every 1.x version of the host package, use <code>"^1.0"</code> or <code>"1.x"</code>
to express this. If you depend on features introduced in 1.5.2, use
<code>"^1.5.2"</code>.</p>
@ -779,7 +780,7 @@ be found or fails to install, then you may put it in the
<code>optionalDependencies</code> object. This is a map of package name to version or
url, just like the <code>dependencies</code> object. The difference is that build
failures do not cause installation to fail. Running <code>npm install --no-optional</code> will prevent these dependencies from being installed.</p>
<p>It is still your programs responsibility to handle the lack of the
<p>It is still your program's responsibility to handle the lack of the
dependency. For example, something like this:</p>
<pre lang="js"><code>try {
var foo = require('foo')
@ -798,7 +799,7 @@ if (foo) {
}
</code></pre>
<p>Entries in <code>optionalDependencies</code> will override entries of the same name in
<code>dependencies</code>, so its usually best to only put in one place.</p>
<code>dependencies</code>, so it's usually best to only put in one place.</p>
<h3 id="engines">engines</h3>
<p>You can specify the version of node that your stuff works on:</p>
<pre lang="json"><code>{
@ -807,9 +808,9 @@ if (foo) {
}
}
</code></pre>
<p>And, like with dependencies, if you dont specify the version (or if you
specify “*” as the version), then any version of node will do.</p>
<p>You can also use the “engines” field to specify which versions of npm are
<p>And, like with dependencies, if you don't specify the version (or if you
specify "*" as the version), then any version of node will do.</p>
<p>You can also use the "engines" field to specify which versions of npm are
capable of properly installing your program. For example:</p>
<pre lang="json"><code>{
"engines": {
@ -831,7 +832,7 @@ module will run on:</p>
}
</code></pre>
<p>You can also block instead of allowing operating systems, just prepend the
blocked os with a !:</p>
blocked os with a '!':</p>
<pre lang="json"><code>{
"os": [
"!win32"
@ -839,7 +840,7 @@ blocked os with a !:</p>
}
</code></pre>
<p>The host operating system is determined by <code>process.platform</code></p>
<p>It is allowed to both block and allow an item, although there isnt any
<p>It is allowed to both block and allow an item, although there isn't any
good reason to do this.</p>
<h3 id="cpu">cpu</h3>
<p>If your code only runs on certain cpu architectures,
@ -869,9 +870,9 @@ a specific registry (for example, an internal registry), then use the
<code>publishConfig</code> dictionary described below to override the <code>registry</code>
config param at publish-time.</p>
<h3 id="publishconfig">publishConfig</h3>
<p>This is a set of config values that will be used at publish-time. Its
<p>This is a set of config values that will be used at publish-time. It's
especially handy if you want to set the tag, registry or access, so that
you can ensure that a given package is not tagged with “latest”, published
you can ensure that a given package is not tagged with "latest", published
to the global public registry or that a scoped module is private by
default.</p>
<p>See <a href="../using-npm/config.html"><code>config</code></a> to see the list of config options that

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>package-lock.json</title>
<style>
body {
@ -158,7 +159,7 @@ teammates, deployments, and continuous integration are guaranteed to
install exactly the same dependencies.</p>
</li>
<li>
<p>Provide a facility for users to “time-travel” to previous states of
<p>Provide a facility for users to "time-travel" to previous states of
<code>node_modules</code> without having to commit the directory itself.</p>
</li>
<li>
@ -189,7 +190,7 @@ root of a project, <code>npm-shrinkwrap.json</code> will take precedence and
<code>package-lock.json</code> will be ignored.</p>
<h3 id="hidden-lockfiles">Hidden Lockfiles</h3>
<p>In order to avoid processing the <code>node_modules</code> folder repeatedly, npm as
of v7 uses a “hidden” lockfile present in
of v7 uses a "hidden" lockfile present in
<code>node_modules/.package-lock.json</code>. This contains information about the
tree, and is used in lieu of reading the entire <code>node_modules</code> hierarchy
provided that the following conditions are met:</p>
@ -211,7 +212,7 @@ modified time on <code>node_modules/foo</code> will not reflect this change. If
are manually editing files in <code>node_modules</code>, it is generally best to
delete the file at <code>node_modules/.package-lock.json</code>.</p>
<p>As the hidden lockfile is ignored by older npm versions, it does not
contain the backwards compatibility affordances present in “normal”
contain the backwards compatibility affordances present in "normal"
lockfiles. That is, it is <code>lockfileVersion: 3</code>, rather than
<code>lockfileVersion: 2</code>.</p>
<h3 id="handling-old-lockfiles">Handling Old Lockfiles</h3>
@ -221,11 +222,11 @@ information from either the <code>node_modules</code> tree or (in the case of em
<code>node_modules</code> trees or very old lockfile formats) the npm registry.</p>
<h3 id="file-format">File Format</h3>
<h4 id="name"><code>name</code></h4>
<p>The name of the package this is a package-lock for. This will match whats
<p>The name of the package this is a package-lock for. This will match what's
in <code>package.json</code>.</p>
<h4 id="version"><code>version</code></h4>
<p>The version of the package this is a package-lock for. This will match
whats in <code>package.json</code>.</p>
what's in <code>package.json</code>.</p>
<h4 id="lockfileversion"><code>lockfileVersion</code></h4>
<p>An integer version, starting at <code>1</code> with the version number of this
document whose semantics were used when generating this
@ -235,7 +236,7 @@ information that would have otherwise required looking in <code>node_modules</co
the npm registry. Lockfiles generated by npm v7 will contain
<code>lockfileVersion: 2</code>.</p>
<ul>
<li>No version provided: an “ancient” shrinkwrap file from a version of npm
<li>No version provided: an "ancient" shrinkwrap file from a version of npm
prior to npm v5.</li>
<li><code>1</code>: The lockfile version used by npm v5 and v6.</li>
<li><code>2</code>: The lockfile version used by npm v7, which is backwards compatible
@ -263,7 +264,7 @@ the case of packages fetched from the registry, this will be a url to a
tarball. In the case of git dependencies, this will be the full git url
with commit sha. In the case of link dependencies, this will be the
location of the link target. <code>registry.npmjs.org</code> is a magic value meaning
“the currently configured registry”.</p>
"the currently configured registry".</p>
</li>
<li>
<p>integrity: A <code>sha512</code> or <code>sha1</code> <a href="https://w3c.github.io/webappsec/specs/subresourceintegrity/">Standard Subresource
@ -334,9 +335,9 @@ dependencies, this is the commit sha.</p>
</li>
<li>
<p>resolved: For registry sources this is path of the tarball relative to
the registry URL. If the tarball URL isnt on the same server as the
the registry URL. If the tarball URL isn't on the same server as the
registry URL then this is a complete URL. <code>registry.npmjs.org</code> is a magic
value meaning “the currently configured registry”.</p>
value meaning "the currently configured registry".</p>
</li>
<li>
<p>bundled: If true, this is the bundled dependency and will be installed

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>config</title>
<style>
body {
@ -177,7 +178,7 @@ would become <code>npm_config_allow_same_version=true</code>.</p>
option <code>--userconfig</code> or environment variable <code>$NPM_CONFIG_USERCONFIG</code>)</li>
<li>global configuration file (defaults to <code>$PREFIX/etc/npmrc</code>; configurable via
CLI option <code>--globalconfig</code> or environment variable <code>$NPM_CONFIG_GLOBALCONFIG</code>)</li>
<li>npms built-in configuration file (<code>/path/to/npm/npmrc</code>)</li>
<li>npm's built-in configuration file (<code>/path/to/npm/npmrc</code>)</li>
</ul>
<p>See <a href="../configuring-npm/npmrc.html">npmrc</a> for more details.</p>
<h4 id="default-configs">Default Configs</h4>
@ -264,8 +265,8 @@ safer to use a registry-provided authentication bearer token stored in the
<!-- raw HTML omitted -->
<h4 id="access"><code>access</code></h4>
<ul>
<li>Default: restricted for scoped packages, public for unscoped packages</li>
<li>Type: null, “restricted”, or “public”</li>
<li>Default: 'restricted' for scoped packages, 'public' for unscoped packages</li>
<li>Type: null, "restricted", or "public"</li>
</ul>
<p>When publishing scoped packages, the access level defaults to <code>restricted</code>.
If you want your scoped package to be publicly viewable (and installable)
@ -302,7 +303,7 @@ to the same value as the current version.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” submit audit reports alongside the current npm command to the
<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@ -311,7 +312,7 @@ submitted.</p>
<h4 id="audit-level"><code>audit-level</code></h4>
<ul>
<li>Default: null</li>
<li>Type: null, “info”, “low”, “moderate”, “high”, “critical”, or “none”</li>
<li>Type: null, "info", "low", "moderate", "high", "critical", or "none"</li>
</ul>
<p>The minimum level of vulnerability for <code>npm audit</code> to exit with a non-zero
exit code.</p>
@ -324,7 +325,7 @@ exit code.</p>
</ul>
<p>If passed to <code>npm install</code>, will rebuild the npm tree such that only
versions that were available <strong>on or before</strong> the <code>--before</code> time get
installed. If theres no versions available for the current set of direct
installed. If there's no versions available for the current set of direct
dependencies, the command will error.</p>
<p>If the requested version is a <code>dist-tag</code> and the given tag does not pass the
<code>--before</code> filter, the most recent version less than or equal to that tag
@ -340,7 +341,7 @@ will be used. For example, <code>foo@latest</code> might install <code>foo@1.2</
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
fact that some file systems dont support symlinks, even on ostensibly Unix
fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -362,11 +363,11 @@ terminal.</p>
</ul>
<p>The Certificate Authority signing certificate that is trusted for SSL
connections to the registry. Values should be in PEM format (Windows calls
it “Base-64 encoded X.509 (.CER)”) with newlines replaced by the string
“\n”. For example:</p>
it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string
"\n". For example:</p>
<pre lang="ini"><code>ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
</code></pre>
<p>Set to <code>null</code> to only allow “known” registrars, or to a specific CA cert to
<p>Set to <code>null</code> to only allow "known" registrars, or to a specific CA cert to
trust only that specific signing authority.</p>
<p>Multiple CAs can be trusted by specifying an array of certificates:</p>
<pre lang="ini"><code>ca[]="..."
@ -380,7 +381,7 @@ ca[]="..."
<li>Default: Windows: <code>%LocalAppData%\npm-cache</code>, Posix: <code>~/.npm</code></li>
<li>Type: Path</li>
</ul>
<p>The location of npms cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<p>The location of npm's cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="cafile"><code>cafile</code></h4>
@ -389,13 +390,13 @@ ca[]="..."
<li>Type: Path</li>
</ul>
<p>A path to a file containing one or multiple Certificate Authority signing
certificates. Similar to the <code>ca</code> setting, but allows for multiple CAs, as
certificates. Similar to the <code>ca</code> setting, but allows for multiple CA's, as
well as for the CA information to be stored in a file on disk.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="call"><code>call</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Optional companion option for <code>npm exec</code>, <code>npx</code> that allows for specifying a
@ -410,11 +411,11 @@ custom command to be run along with the installed packages.</p>
<li>Type: null or String</li>
</ul>
<p>A client certificate to pass when accessing the registry. Values should be
in PEM format (Windows calls it “Base-64 encoded X.509 (.CER)”) with
newlines replaced by the string “\n”. For example:</p>
in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
newlines replaced by the string "\n". For example:</p>
<pre lang="ini"><code>cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
</code></pre>
<p>It is <em>not</em> the path to a certificate file (and there is no “certfile”
<p>It is <em>not</em> the path to a certificate file (and there is no "certfile"
option).</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -440,8 +441,8 @@ tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="color"><code>color</code></h4>
<ul>
<li>Default: true unless the NO_COLOR environ is set to something other than 0</li>
<li>Type: “always” or Boolean</li>
<li>Default: true unless the NO_COLOR environ is set to something other than '0'</li>
<li>Type: "always" or Boolean</li>
</ul>
<p>If false, never shows colors. If <code>"always"</code> then always shows colors. If
true, then only prints color codes for tty file descriptors.</p>
@ -483,7 +484,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="diff-dst-prefix"><code>diff-dst-prefix</code></h4>
<ul>
<li>Default: “b/”</li>
<li>Default: "b/"</li>
<li>Type: String</li>
</ul>
<p>Destination prefix to be used in <code>npm diff</code> output.</p>
@ -517,7 +518,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="diff-src-prefix"><code>diff-src-prefix</code></h4>
<ul>
<li>Default: “a/”</li>
<li>Default: "a/"</li>
<li>Type: String</li>
</ul>
<p>Source prefix to be used in <code>npm diff</code> output.</p>
@ -544,7 +545,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Indicates that you dont want npm to make any changes and that it should
<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@ -554,8 +555,8 @@ commands that modify your local installation, eg, <code>install</code>, <code>up
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
<li>Default: The EDITOR or VISUAL environment variables, or notepad.exe on
Windows, or vim on Unix systems</li>
<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>
@ -577,7 +578,7 @@ Node.js version.</p>
<li>Default: 2</li>
<li>Type: Number</li>
</ul>
<p>The “retries” config for the <code>retry</code> module to use when fetching packages
<p>The "retries" config for the <code>retry</code> module to use when fetching packages
from the registry.</p>
<p>npm will retry idempotent read requests to the registry in the case of
network failures or 5xx HTTP errors.</p>
@ -588,7 +589,7 @@ network failures or 5xx HTTP errors.</p>
<li>Default: 10</li>
<li>Type: Number</li>
</ul>
<p>The “factor” config for the <code>retry</code> module to use when fetching packages.</p>
<p>The "factor" config for the <code>retry</code> module to use when fetching packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></h4>
@ -596,7 +597,7 @@ network failures or 5xx HTTP errors.</p>
<li>Default: 60000 (1 minute)</li>
<li>Type: Number</li>
</ul>
<p>The “maxTimeout” config for the <code>retry</code> module to use when fetching
<p>The "maxTimeout" config for the <code>retry</code> module to use when fetching
packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -605,7 +606,7 @@ packages.</p>
<li>Default: 10000 (10 seconds)</li>
<li>Type: Number</li>
</ul>
<p>The “minTimeout” config for the <code>retry</code> module to use when fetching
<p>The "minTimeout" config for the <code>retry</code> module to use when fetching
packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -639,7 +640,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
<p>If you dont have a clear idea of what you want to do, it is strongly
<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -669,13 +670,13 @@ file.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>When “true” displays the message at the end of each <code>npm install</code>
<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="git"><code>git</code></h4>
<ul>
<li>Default: “git”</li>
<li>Default: "git"</li>
<li>Type: String</li>
</ul>
<p>The command to use for git commands. If git is installed on the computer,
@ -695,7 +696,7 @@ but is not in the <code>PATH</code>, then set this to the full path to the git b
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@ -721,8 +722,8 @@ will be preferred.</p>
<!-- raw HTML omitted -->
<h4 id="globalconfig"><code>globalconfig</code></h4>
<ul>
<li>Default: The global prefix setting plus etc/npmrc. For example,
/usr/local/etc/npmrc</li>
<li>Default: The global --prefix setting plus 'etc/npmrc'. For example,
'/usr/local/etc/npmrc'</li>
<li>Type: Path</li>
</ul>
<p>The config file to read for global config options.</p>
@ -730,7 +731,7 @@ will be preferred.</p>
<!-- raw HTML omitted -->
<h4 id="heading"><code>heading</code></h4>
<ul>
<li>Default: “npm”</li>
<li>Default: "npm"</li>
<li>Type: String</li>
</ul>
<p>The string that starts all the debugging log output.</p>
@ -753,9 +754,9 @@ library.</p>
<li>Type: Boolean</li>
</ul>
<p>If true, npm will not exit with an error code when <code>run-script</code> is invoked
for a script that isnt defined in the <code>scripts</code> section of <code>package.json</code>.
This option can be used when its desirable to optionally run a script when
its present and fail if the script fails. This is useful, for example, when
for a script that isn't defined in the <code>scripts</code> section of <code>package.json</code>.
This option can be used when it's desirable to optionally run a script when
it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.</p>
<!-- raw HTML omitted -->
@ -775,7 +776,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<h4 id="include"><code>include</code></h4>
<ul>
<li>Default:</li>
<li>Type: “prod”, “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Type: "prod", "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Option that allows for defining which types of dependencies to install.</p>
<p>This is the inverse of <code>--omit=&lt;type&gt;</code>.</p>
@ -788,7 +789,7 @@ the order in which omit/include are specified on the command-line.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>Allow installing “staged” published packages, as defined by <a href="https://github.com/npm/rfcs/pull/92">npm RFC PR
<p>Allow installing "staged" published packages, as defined by <a href="https://github.com/npm/rfcs/pull/92">npm RFC PR
#92</a>.</p>
<p>This is experimental, and not implemented by the npm public registry.</p>
<!-- raw HTML omitted -->
@ -806,32 +807,32 @@ the specified workspaces, and not on the root project.</p>
<!-- raw HTML omitted -->
<h4 id="init-author-email"><code>init-author-email</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>The value <code>npm init</code> should use by default for the package authors email.</p>
<p>The value <code>npm init</code> should use by default for the package author's email.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-author-name"><code>init-author-name</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>The value <code>npm init</code> should use by default for the package authors name.</p>
<p>The value <code>npm init</code> should use by default for the package author's name.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-author-url"><code>init-author-url</code></h4>
<ul>
<li>Default: “”</li>
<li>Type: “” or URL</li>
<li>Default: ""</li>
<li>Type: "" or URL</li>
</ul>
<p>The value <code>npm init</code> should use by default for the package authors
<p>The value <code>npm init</code> should use by default for the package author's
homepage.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-license"><code>init-license</code></h4>
<ul>
<li>Default: “ISC”</li>
<li>Default: "ISC"</li>
<li>Type: String</li>
</ul>
<p>The value <code>npm init</code> should use by default for the package license.</p>
@ -839,7 +840,7 @@ homepage.</p>
<!-- raw HTML omitted -->
<h4 id="init-module"><code>init-module</code></h4>
<ul>
<li>Default: “~/.npm-init.js”</li>
<li>Default: "~/.npm-init.js"</li>
<li>Type: Path</li>
</ul>
<p>A module that will be loaded by the <code>npm init</code> command. See the
@ -850,7 +851,7 @@ more information, or <a href="../commands/npm-init.html">npm init</a>.</p>
<!-- raw HTML omitted -->
<h4 id="init-version"><code>init-version</code></h4>
<ul>
<li>Default: “1.0.0”</li>
<li>Default: "1.0.0"</li>
<li>Type: SemVer string</li>
</ul>
<p>The value that <code>npm init</code> should use by default for the package version
@ -876,10 +877,10 @@ saving them to your <code>package.json</code>.</li>
<li>Type: null or String</li>
</ul>
<p>A client key to pass when accessing the registry. Values should be in PEM
format with newlines replaced by the string “\n”. For example:</p>
format with newlines replaced by the string "\n". For example:</p>
<pre lang="ini"><code>key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
</code></pre>
<p>It is <em>not</em> the path to a key file (and there is no “keyfile” option).</p>
<p>It is <em>not</em> the path to a key file (and there is no "keyfile" option).</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="legacy-bundling"><code>legacy-bundling</code></h4>
@ -928,9 +929,9 @@ npm registry. Must be IPv4 in versions of Node prior to 0.12.</p>
<!-- raw HTML omitted -->
<h4 id="location"><code>location</code></h4>
<ul>
<li>Default: “user” unless <code>--global</code> is passed, which will also set this value
to “global”</li>
<li>Type: “global”, “user”, or “project”</li>
<li>Default: "user" unless <code>--global</code> is passed, which will also set this value
to "global"</li>
<li>Type: "global", "user", or "project"</li>
</ul>
<p>When passed to <code>npm config</code> this refers to which config file to use.</p>
<!-- raw HTML omitted -->
@ -939,7 +940,7 @@ to “global”</li>
<ul>
<li>Default: Version 2 if no lockfile or current lockfile version less than or
equal to 2, otherwise maintain current lockfile version</li>
<li>Type: null, 1, 2, 3, “1”, “2”, or “3”</li>
<li>Type: null, 1, 2, 3, "1", "2", or "3"</li>
</ul>
<p>Set the lockfile format version to be used in package-lock.json and
npm-shrinkwrap-json files. Possible options are:</p>
@ -957,14 +958,14 @@ Ideal if all users are on npm version 7 and higher.</p>
<!-- raw HTML omitted -->
<h4 id="loglevel"><code>loglevel</code></h4>
<ul>
<li>Default: “notice”</li>
<li>Type: “silent”, “error”, “warn”, “notice”, “http”, “timing”, “info”,
“verbose”, or “silly”</li>
<li>Default: "notice"</li>
<li>Type: "silent", "error", "warn", "notice", "http", "timing", "info",
"verbose", or "silly"</li>
</ul>
<p>What level of logs to report. On failure, <em>all</em> logs are written to
<code>npm-debug.log</code> in the current working directory.</p>
<p>Any logs of a higher level than the setting are shown. The default is
“notice”.</p>
"notice".</p>
<p>See also the <code>foreground-scripts</code> config.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -995,11 +996,11 @@ combination).</p>
<!-- raw HTML omitted -->
<h4 id="message"><code>message</code></h4>
<ul>
<li>Default: “%s”</li>
<li>Default: "%s"</li>
<li>Type: String</li>
</ul>
<p>Commit message which is used by <code>npm version</code> when creating version commit.</p>
<p>Any “%s” in the message will be replaced with the version number.</p>
<p>Any "%s" in the message will be replaced with the version number.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="node-options"><code>node-options</code></h4>
@ -1017,7 +1018,7 @@ how lifecycle scripts are called.</p>
<li>Default: Node.js <code>process.version</code> value</li>
<li>Type: SemVer string</li>
</ul>
<p>The node version to use when checking a packages <code>engines</code> setting.</p>
<p>The node version to use when checking a package's <code>engines</code> setting.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="noproxy"><code>noproxy</code></h4>
@ -1034,7 +1035,7 @@ how lifecycle scripts are called.</p>
<li>Default: Output of <code>npm --version</code></li>
<li>Type: SemVer string</li>
</ul>
<p>The npm version to use when checking a packages <code>engines</code> setting.</p>
<p>The npm version to use when checking a package's <code>engines</code> setting.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="offline"><code>offline</code></h4>
@ -1048,9 +1049,9 @@ allow the CLI to fill in missing cache data, see <code>--prefer-offline</code>.<
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
<li>Default: dev if the <code>NODE_ENV</code> environment variable is set to
production, otherwise empty.</li>
<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
'production', otherwise empty.</li>
<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@ -1067,7 +1068,7 @@ variable will be set to <code>'production'</code> for all lifecycle scripts.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
<p>This is a one-time password from a two-factor authenticator. Its needed
<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
@ -1075,7 +1076,7 @@ password, npm will prompt on the command line for one.</p>
<!-- raw HTML omitted -->
<h4 id="pack-destination"><code>pack-destination</code></h4>
<ul>
<li>Default: “.”</li>
<li>Default: "."</li>
<li>Type: String</li>
</ul>
<p>Directory in which <code>npm pack</code> will save tarballs.</p>
@ -1155,10 +1156,10 @@ forces non-global commands to run in the specified folder.</p>
<!-- raw HTML omitted -->
<h4 id="preid"><code>preid</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>The “prerelease identifier” to use as a prefix for the “prerelease” part of
<p>The "prerelease identifier" to use as a prefix for the "prerelease" part of
a semver. Like the <code>rc</code> in <code>1.2.0-rc.8</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@ -1201,7 +1202,7 @@ access tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
<li>Default: <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a></li>
<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@ -1242,7 +1243,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
rather than using npms default semver range operator.</p>
rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="save-optional"><code>save-optional</code></h4>
@ -1263,7 +1264,7 @@ rather than using npms default semver range operator.</p>
<!-- raw HTML omitted -->
<h4 id="save-prefix"><code>save-prefix</code></h4>
<ul>
<li>Default: “^”</li>
<li>Default: "^"</li>
<li>Type: String</li>
</ul>
<p>Configure how versions of packages installed to a package.json file via
@ -1287,7 +1288,7 @@ or <code>--save-optional</code> are true.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
<li>Default: the scope of the current project, if any, or “”</li>
<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>
@ -1310,7 +1311,7 @@ npm init --scope=@foo --yes
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
<li>Default: /bin/sh on POSIX systems, cmd.exe on Windows</li>
<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
@ -1318,7 +1319,7 @@ npm init --scope=@foo --yes
<!-- raw HTML omitted -->
<h4 id="searchexclude"><code>searchexclude</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that limit the results from search.</p>
@ -1335,7 +1336,7 @@ searches.</p>
<!-- raw HTML omitted -->
<h4 id="searchopts"><code>searchopts</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that are always passed to search.</p>
@ -1352,7 +1353,7 @@ using legacy search endpoint.</p>
<!-- raw HTML omitted -->
<h4 id="shell"><code>shell</code></h4>
<ul>
<li>Default: SHELL environment variable, or “bash” on Posix, or “cmd.exe” on
<li>Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on
Windows</li>
<li>Type: String</li>
</ul>
@ -1393,7 +1394,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
the range set in their packages <code>peerDependencies</code> object.</p>
the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@ -1411,10 +1412,10 @@ via https.</p>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
<li>Default: “latest”</li>
<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
<p>If you ask npm to install a package and dont tell it a specific version,
<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>
@ -1424,7 +1425,7 @@ tarball that will be compared with the local files by default.</p>
<!-- raw HTML omitted -->
<h4 id="tag-version-prefix"><code>tag-version-prefix</code></h4>
<ul>
<li>Default: “v”</li>
<li>Default: "v"</li>
<li>Type: String</li>
</ul>
<p>If set, alters the prefix used when tagging a new version when performing a
@ -1452,7 +1453,7 @@ successfully. <code>_timing.json</code> is a newline delimited list of JSON obje
<li>Default: 0</li>
<li>Type: Octal numeric string in range 0000..0777 (0..511)</li>
</ul>
<p>The “umask” value to use when setting the file creation mode on files and
<p>The "umask" value to use when setting the file creation mode on files and
folders.</p>
<p>Folders and executables are given a mode which is <code>0o777</code> masked against
this value. Other files are given a mode which is <code>0o666</code> masked against
@ -1494,8 +1495,8 @@ of npm than the latest.</p>
<!-- raw HTML omitted -->
<h4 id="user-agent"><code>user-agent</code></h4>
<ul>
<li>Default: npm/{npm-version} node/{node-version} {platform} {arch}
workspaces/{workspaces} {ci}</li>
<li>Default: "npm/{npm-version} node/{node-version} {platform} {arch}
workspaces/{workspaces} {ci}"</li>
<li>Type: String</li>
</ul>
<p>Sets the User-Agent request header. The following fields are replaced with
@ -1514,7 +1515,7 @@ an empty string if <code>ci-name</code> is empty.</li>
<!-- raw HTML omitted -->
<h4 id="userconfig"><code>userconfig</code></h4>
<ul>
<li>Default: “~/.npmrc”</li>
<li>Default: "~/.npmrc"</li>
<li>Type: Path</li>
</ul>
<p>The location of user-level configuration settings.</p>
@ -1537,15 +1538,15 @@ settings in the <code>globalconfig</code> file.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>If true, output the npm version as well as nodes <code>process.versions</code> map and
the version in the current working directorys <code>package.json</code> file if one
<p>If true, output the npm version as well as node's <code>process.versions</code> map and
the version in the current working directory's <code>package.json</code> file if one
exists, and exit successfully.</p>
<p>Only relevant when specified explicitly on the command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="viewer"><code>viewer</code></h4>
<ul>
<li>Default: “man” on Posix, “browser” on Windows</li>
<li>Default: "man" on Posix, "browser" on Windows</li>
<li>Type: String</li>
</ul>
<p>The program to use to view help content.</p>
@ -1604,23 +1605,23 @@ other things (test, exec, publish, etc.) will operate on the root project,
<li>Default: null</li>
<li>Type: null or Boolean</li>
</ul>
<p>Automatically answer “yes” to any prompts that npm might print on the
<p>Automatically answer "yes" to any prompts that npm might print on the
command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="also"><code>also</code></h4>
<ul>
<li>Default: null</li>
<li>Type: null, “dev”, or “development”</li>
<li>DEPRECATED: Please use include=dev instead.</li>
<li>Type: null, "dev", or "development"</li>
<li>DEPRECATED: Please use --include=dev instead.</li>
</ul>
<p>When set to <code>dev</code> or <code>development</code>, this is an alias for <code>--include=dev</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="auth-type"><code>auth-type</code></h4>
<ul>
<li>Default: “legacy”</li>
<li>Type: “legacy”, “sso”, “saml”, or “oauth”</li>
<li>Default: "legacy"</li>
<li>Type: "legacy", "sso", "saml", or "oauth"</li>
<li>DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
in a future version of npm in favor of web-based login.</li>
</ul>
@ -1649,14 +1650,14 @@ in a future version of npm in favor of web-based login.</li>
<ul>
<li>Default: false</li>
<li>Type: Boolean</li>
<li>DEPRECATED: Please use include=dev instead.</li>
<li>DEPRECATED: Please use --include=dev instead.</li>
</ul>
<p>Alias for <code>--include=dev</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="initauthoremail"><code>init.author.email</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-author-email</code> instead.</li>
</ul>
@ -1665,7 +1666,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initauthorname"><code>init.author.name</code></h4>
<ul>
<li>Default: “”</li>
<li>Default: ""</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-author-name</code> instead.</li>
</ul>
@ -1674,8 +1675,8 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initauthorurl"><code>init.author.url</code></h4>
<ul>
<li>Default: “”</li>
<li>Type: “” or URL</li>
<li>Default: ""</li>
<li>Type: "" or URL</li>
<li>DEPRECATED: Use <code>--init-author-url</code> instead.</li>
</ul>
<p>Alias for <code>--init-author-url</code></p>
@ -1683,7 +1684,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initlicense"><code>init.license</code></h4>
<ul>
<li>Default: “ISC”</li>
<li>Default: "ISC"</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-license</code> instead.</li>
</ul>
@ -1692,7 +1693,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initmodule"><code>init.module</code></h4>
<ul>
<li>Default: “~/.npm-init.js”</li>
<li>Default: "~/.npm-init.js"</li>
<li>Type: Path</li>
<li>DEPRECATED: Use <code>--init-module</code> instead.</li>
</ul>
@ -1701,7 +1702,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initversion"><code>init.version</code></h4>
<ul>
<li>Default: “1.0.0”</li>
<li>Default: "1.0.0"</li>
<li>Type: SemVer string</li>
<li>DEPRECATED: Use <code>--init-version</code> instead.</li>
</ul>
@ -1711,7 +1712,7 @@ in a future version of npm in favor of web-based login.</li>
<h4 id="only"><code>only</code></h4>
<ul>
<li>Default: null</li>
<li>Type: null, “prod”, or “production”</li>
<li>Type: null, "prod", or "production"</li>
<li>DEPRECATED: Use <code>--omit=dev</code> to omit dev dependencies from the install.</li>
</ul>
<p>When set to <code>prod</code> or <code>production</code>, this is an alias for <code>--omit=dev</code>.</p>
@ -1725,7 +1726,7 @@ in a future version of npm in favor of web-based login.</li>
<code>--include=optional</code> to include them.</li>
</ul>
<p>Default value does install optional deps unless otherwise omitted.</p>
<p>Alias for include=optional or omit=optional</p>
<p>Alias for --include=optional or --omit=optional</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="production"><code>production</code></h4>
@ -1741,16 +1742,16 @@ in a future version of npm in favor of web-based login.</li>
<ul>
<li>Default: true</li>
<li>Type: Boolean</li>
<li>DEPRECATED: Use the package-lock setting instead.</li>
<li>DEPRECATED: Use the --package-lock setting instead.</li>
</ul>
<p>Alias for package-lock</p>
<p>Alias for --package-lock</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="sso-poll-frequency"><code>sso-poll-frequency</code></h4>
<ul>
<li>Default: 500</li>
<li>Type: Number</li>
<li>DEPRECATED: The auth-type method of SSO/SAML/OAuth will be removed in a
<li>DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a
future version of npm in favor of web-based login.</li>
</ul>
<p>When used with SSO-enabled <code>auth-type</code>s, configures how regularly the
@ -1759,9 +1760,9 @@ registry should be polled while the user is completing authentication.</p>
<!-- raw HTML omitted -->
<h4 id="sso-type"><code>sso-type</code></h4>
<ul>
<li>Default: “oauth”</li>
<li>Type: null, “oauth”, or “saml”</li>
<li>DEPRECATED: The auth-type method of SSO/SAML/OAuth will be removed in a
<li>Default: "oauth"</li>
<li>Type: null, "oauth", or "saml"</li>
<li>DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a
future version of npm in favor of web-based login.</li>
</ul>
<p>If <code>--auth-type=sso</code>, the type of SSO type to use.</p>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>developers</title>
<style>
body {
@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
<p>So, youve decided to use npm to develop (and maybe publish/deploy)
<p>So, you've decided to use npm to develop (and maybe publish/deploy)
your project.</p>
<p>Fantastic!</p>
<p>There are a few things that you need to do above the simple steps
@ -162,7 +163,7 @@ topic, or <code>npm help thing</code> to see the same information.</p>
<li>c) a url that resolves to (b)</li>
<li>d) a <code>&lt;name&gt;@&lt;version&gt;</code> that is published on the registry with (c)</li>
<li>e) a <code>&lt;name&gt;@&lt;tag&gt;</code> that points to (d)</li>
<li>f) a <code>&lt;name&gt;</code> that has a “latest” tag satisfying (e)</li>
<li>f) a <code>&lt;name&gt;</code> that has a "latest" tag satisfying (e)</li>
<li>g) a <code>git</code> url that, when cloned, results in (a).</li>
</ul>
<p>Even if you never publish your package, you can still get a lot of
@ -187,9 +188,9 @@ goes in that file. At the very least, you need:</p>
<li>
<p>name: This should be a string that identifies your project. Please do
not use the name to specify that it runs on node, or is in JavaScript.
You can use the “engines” field to explicitly state the versions of node
(or whatever else) that your program requires, and its pretty well
assumed that its JavaScript.</p>
You can use the "engines" field to explicitly state the versions of node
(or whatever else) that your program requires, and it's pretty well
assumed that it's JavaScript.</p>
<p>It does not necessarily need to match your github repository name.</p>
<p>So, <code>node-foo</code> and <code>bar-js</code> are bad names. <code>foo</code> or <code>bar</code> are better.</p>
</li>
@ -207,24 +208,24 @@ new functionality that you depend on. Be explicit.</p>
<li>
<p>scripts: If you have a special compilation or installation script, then
you should put it in the <code>scripts</code> object. You should definitely have at
least a basic smoke-test command as the “scripts.test” field. See
least a basic smoke-test command as the "scripts.test" field. See
<a href="../using-npm/scripts.html">scripts</a>.</p>
</li>
<li>
<p>main: If you have a single module that serves as the entry point to your
program (like what the “foo” package gives you at require(“foo”)), then
you need to specify that in the “main” field.</p>
program (like what the "foo" package gives you at require("foo")), then
you need to specify that in the "main" field.</p>
</li>
<li>
<p>directories: This is an object mapping names to folders. The best ones
to include are “lib” and “doc”, but if you use “man” to specify a folder
full of man pages, theyll get installed just like these ones.</p>
to include are "lib" and "doc", but if you use "man" to specify a folder
full of man pages, they'll get installed just like these ones.</p>
</li>
</ul>
<p>You can use <code>npm init</code> in the root of your package in order to get you
started with a pretty basic package.json file. See <a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p>
<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</h3>
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If theres no
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there's no
<code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will ignore
the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to include
something that is excluded by your <code>.gitignore</code> file, you can create an
@ -240,14 +241,16 @@ as <code>.gitignore</code> files:</p>
<li>You can end patterns with a forward slash <code>/</code> to specify a directory.</li>
<li>You can negate a pattern by starting it with an exclamation point <code>!</code>.</li>
</ul>
<p>By default, the following paths and files are ignored, so theres no
<p>By default, the following paths and files are ignored, so there's no
need to add them to <code>.npmignore</code> explicitly:</p>
<ul>
<li><code>.*.swp</code></li>
<li><code>._*</code></li>
<li><code>.DS_Store</code></li>
<li><code>.git</code></li>
<li><code>.gitignore</code></li>
<li><code>.hg</code></li>
<li><code>.npmignore</code></li>
<li><code>.npmrc</code></li>
<li><code>.lock-wscript</code></li>
<li><code>.svn</code></li>
@ -257,7 +260,7 @@ need to add them to <code>.npmignore</code> explicitly:</p>
<li><code>npm-debug.log</code></li>
</ul>
<p>Additionally, everything in <code>node_modules</code> is ignored, except for
bundled dependencies. npm automatically handles this for you, so dont
bundled dependencies. npm automatically handles this for you, so don't
bother adding <code>node_modules</code> to <code>.npmignore</code>.</p>
<p>The following paths and files are never ignored, so adding them to
<code>.npmignore</code> is pointless:</p>
@ -285,25 +288,25 @@ of course.)</p>
<p>More info at <a href="../commands/npm-link.html"><code>npm link</code></a>.</p>
<h3 id="before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</h3>
<p><strong>This is important.</strong></p>
<p>If you can not install it locally, youll have
problems trying to publish it. Or, worse yet, youll be able to
publish it, but youll be publishing a broken or pointless package.
So dont do that.</p>
<p>If you can not install it locally, you'll have
problems trying to publish it. Or, worse yet, you'll be able to
publish it, but you'll be publishing a broken or pointless package.
So don't do that.</p>
<p>In the root of your package, do this:</p>
<pre lang="bash"><code>npm install . -g
</code></pre>
<p>Thatll show you that its working. If youd rather just create a symlink
<p>That'll show you that it's working. If you'd rather just create a symlink
package that points to your working directory, then do this:</p>
<pre lang="bash"><code>npm link
</code></pre>
<p>Use <code>npm ls -g</code> to see if its there.</p>
<p>Use <code>npm ls -g</code> to see if it's there.</p>
<p>To test a local install, go into some other folder, and then do:</p>
<pre lang="bash"><code>cd ../some-other-folder
npm install ../my-package
</code></pre>
<p>to install it locally into the node_modules folder in that other place.</p>
<p>Then go into the node-repl, and try using require(“my-thing”) to
bring in your modules main module.</p>
<p>Then go into the node-repl, and try using require("my-thing") to
bring in your module's main module.</p>
<h3 id="create-a-user-account">Create a User Account</h3>
<p>Create a user with the adduser command. It works like this:</p>
<pre lang="bash"><code>npm adduser
@ -311,7 +314,7 @@ bring in your modules main module.</p>
<p>and then follow the prompts.</p>
<p>This is documented better in <a href="../commands/npm-adduser.html">npm adduser</a>.</p>
<h3 id="publish-your-package">Publish your Package</h3>
<p>This parts easy. In the root of your folder, do this:</p>
<p>This part's easy. In the root of your folder, do this:</p>
<pre lang="bash"><code>npm publish
</code></pre>
<p>You can give publish a url to a tarball, or a filename of a tarball,

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>orgs</title>
<style>
body {

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>registry</title>
<style>
body {
@ -141,7 +142,7 @@ npm command-line interface
<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#does-npm-send-any-information-about-me-back-to-the-registry">Does npm send any information about me back to the registry?</a></li><li><a href="#how-can-i-prevent-my-package-from-being-published-in-the-official-registry">How can I prevent my package from being published in the official registry?</a></li><li><a href="#where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; others, published packages?</a></li><li><a href="#see-also">See also</a></li></ul></div>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#does-npm-send-any-information-about-me-back-to-the-registry">Does npm send any information about me back to the registry?</a></li><li><a href="#how-can-i-prevent-my-package-from-being-published-in-the-official-registry">How can I prevent my package from being published in the official registry?</a></li><li><a href="#where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other's, published packages?</a></li><li><a href="#see-also">See also</a></li></ul></div>
</section>
<div id="_content"><h3 id="description">Description</h3>
@ -152,9 +153,9 @@ package info.</p>
<a href="https://registry.npmjs.org">https://registry.npmjs.org</a> by default. Use of the npm public registry is
subject to terms of use available at <a href="https://docs.npmjs.com/policies/terms">https://docs.npmjs.com/policies/terms</a>.</p>
<p>You can configure npm to use any compatible registry you like, and even run
your own registry. Use of someone elses registry may be governed by their
your own registry. Use of someone else's registry may be governed by their
terms of use.</p>
<p>npms package registry implementation supports several
<p>npm's package registry implementation supports several
write APIs as well, to allow for publishing packages and managing user
account information.</p>
<p>The npm public registry is powered by a CouchDB database,
@ -162,9 +163,9 @@ of which there is a public mirror at <a href="https://skimdb.npmjs.com/registry"
<p>The registry URL used is determined by the scope of the package (see
<a href="../using-npm/scope.html"><code>scope</code></a>. If no scope is specified, the default registry is used, which is
supplied by the <code>registry</code> config parameter. See <a href="../commands/npm-config.html"><code>npm config</code></a>,
<a href="../configuring-npm/npmrc.html"><code>npmrc</code></a>, and <a href="../using-npm/config.html"><code>config</code></a> for more on managing npms configuration.</p>
<a href="../configuring-npm/npmrc.html"><code>npmrc</code></a>, and <a href="../using-npm/config.html"><code>config</code></a> for more on managing npm's configuration.</p>
<p>When the default registry is used in a package-lock or shrinkwrap is has the
special meaning of “the currently configured registry”. If you create a lock
special meaning of "the currently configured registry". If you create a lock
file while using the default registry you can switch to another registry and
npm will install packages from the new registry, but if you create a lock
file while using a custom registry packages will be installed from that
@ -178,10 +179,10 @@ about your environment:</p>
scope. In the future npm hopes to build registry features that use this
information to allow you to customize your experience for your
organization.</li>
<li><code>Npm-In-CI</code> Set to “true” if npm believes this install is running in a
continuous integration environment, “false” otherwise. This is detected by
<li><code>Npm-In-CI</code> Set to "true" if npm believes this install is running in a
continuous integration environment, "false" otherwise. This is detected by
looking for the following environment variables: <code>CI</code>, <code>TDDIUM</code>,
<code>JENKINS_URL</code>, <code>bamboo.buildKey</code>. If youd like to learn more you may find
<code>JENKINS_URL</code>, <code>bamboo.buildKey</code>. If you'd like to learn more you may find
the <a href="https://github.com/npm/npm-registry-client/pull/129">original PR</a>
interesting.
This is used to gather better metrics on how npm is used by humans, versus
@ -195,7 +196,7 @@ published at all, or
<code>"publishConfig":{"registry":"http://my-internal-registry.local"}</code>
to force it to be published only to your internal/private registry.</p>
<p>See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for more info on what goes in the package.json file.</p>
<h3 id="where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; others, published packages?</h3>
<h3 id="where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other's, published packages?</h3>
<p><a href="https://www.npmjs.com/">https://www.npmjs.com/</a></p>
<h3 id="see-also">See also</h3>
<ul>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>removal</title>
<style>
body {
@ -153,12 +154,12 @@ npm command-line interface
</code></pre>
<h3 id="more-severe-uninstalling">More Severe Uninstalling</h3>
<p>Usually, the above instructions are sufficient. That will remove
npm, but leave behind anything youve installed.</p>
<p>If that doesnt work, or if you require more drastic measures,
npm, but leave behind anything you've installed.</p>
<p>If that doesn't work, or if you require more drastic measures,
continue reading.</p>
<p>Note that this is only necessary for globally-installed packages. Local
installs are completely contained within a projects <code>node_modules</code>
folder. Delete that folder, and everything is gone less a packages
installs are completely contained within a project's <code>node_modules</code>
folder. Delete that folder, and everything is gone less a package's
install script is particularly ill-behaved).</p>
<p>This assumes that you installed node and npm in the default place. If
you configured node with a different <code>--prefix</code>, or installed npm with a

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>scope</title>
<style>
body {
@ -154,7 +155,7 @@ and followed by a slash, e.g.</p>
<p>Scopes are a way of grouping related packages together, and also affect a few
things about the way npm treats the package.</p>
<p>Each npm user/organization has their own scope, and only you can add packages
in your scope. This means you dont have to worry about someone taking your
in your scope. This means you don't have to worry about someone taking your
package name ahead of you. Thus it is also a good way to signal official packages
for organizations.</p>
<p>Scoped packages can be published and installed as of <code>npm@2</code> and are supported

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>scripts</title>
<style>
body {
@ -153,9 +154,9 @@ commands with matching names will be run for those as well (e.g. <code>premyscri
<code>myscript</code>, <code>postmyscript</code>). Scripts from dependencies can be run with
<code>npm explore &lt;pkg&gt; -- npm run &lt;stage&gt;</code>.</p>
<h3 id="pre--post-scripts">Pre &amp; Post Scripts</h3>
<p>To create “pre” or “post” scripts for any scripts defined in the
<p>To create "pre" or "post" scripts for any scripts defined in the
<code>"scripts"</code> section of the <code>package.json</code>, simply create another script
<em>with a matching name</em> and add “pre” or “post” to the beginning of them.</p>
<em>with a matching name</em> and add "pre" or "post" to the beginning of them.</p>
<pre lang="json"><code>{
"scripts": {
"precompress": "{{ executes BEFORE the `compress` script }}",
@ -213,8 +214,8 @@ and <code>npm install</code>. See below for more info.</li>
</ul>
<p><strong>prepack</strong></p>
<ul>
<li>Runs BEFORE a tarball is packed (on <code>npm pack</code>”, “<code>npm publish</code>, and when installing a git dependencies).</li>
<li>NOTE: <code>npm run pack</code>” is NOT the same as “<code>npm pack</code>”. “<code>npm run pack</code>” is an arbitrary user defined script name, where as, “<code>npm pack</code> is a CLI defined command.</li>
<li>Runs BEFORE a tarball is packed (on "<code>npm pack</code>", "<code>npm publish</code>", and when installing a git dependencies).</li>
<li>NOTE: "<code>npm run pack</code>" is NOT the same as "<code>npm pack</code>". "<code>npm run pack</code>" is an arbitrary user defined script name, where as, "<code>npm pack</code>" is a CLI defined command.</li>
</ul>
<p><strong>postpack</strong></p>
<ul>
@ -222,7 +223,7 @@ and <code>npm install</code>. See below for more info.</li>
</ul>
<h4 id="prepare-and-prepublish">Prepare and Prepublish</h4>
<p><strong>Deprecation Note: prepublish</strong></p>
<p>Since <code>npm@1.1.71</code>, the npm CLI has run the <code>prepublish</code> script for both <code>npm publish</code> and <code>npm install</code>, because its a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, <a href="https://github.com/npm/npm/issues/10074">very confusing</a>. As of <code>npm@4.0.0</code>, a new event has been introduced, <code>prepare</code>, that preserves this existing behavior. A <em>new</em> event, <code>prepublishOnly</code> has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on <code>npm publish</code> (for instance, running the tests one last time to ensure theyre in good shape).</p>
<p>Since <code>npm@1.1.71</code>, the npm CLI has run the <code>prepublish</code> script for both <code>npm publish</code> and <code>npm install</code>, because it's a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, <a href="https://github.com/npm/npm/issues/10074">very confusing</a>. As of <code>npm@4.0.0</code>, a new event has been introduced, <code>prepare</code>, that preserves this existing behavior. A <em>new</em> event, <code>prepublishOnly</code> has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on <code>npm publish</code> (for instance, running the tests one last time to ensure they're in good shape).</p>
<p>See <a href="https://github.com/npm/npm/issues/10074">https://github.com/npm/npm/issues/10074</a> for a much lengthier justification, with further reading, for this change.</p>
<p><strong>Use Cases</strong></p>
<p>If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the target system, use a <code>prepublish</code> script. This includes tasks such as:</p>
@ -234,10 +235,10 @@ and <code>npm install</code>. See below for more info.</li>
<p>The advantage of doing these things at <code>prepublish</code> time is that they can be done once, in a single place, thus reducing complexity and variability. Additionally, this means that:</p>
<ul>
<li>You can depend on <code>coffee-script</code> as a <code>devDependency</code>, and thus
your users dont need to have it installed.</li>
<li>You dont need to include minifiers in your package, reducing
your users don't need to have it installed.</li>
<li>You don't need to include minifiers in your package, reducing
the size for your users.</li>
<li>You dont need to rely on your users having <code>curl</code> or <code>wget</code> or
<li>You don't need to rely on your users having <code>curl</code> or <code>wget</code> or
other system tools on the target machines.</li>
</ul>
<h3 id="life-cycle-operation-order">Life Cycle Operation Order</h3>
@ -273,7 +274,7 @@ other system tools on the target machines.</li>
<li><code>postprepare</code></li>
</ul>
<p>If there is a <code>binding.gyp</code> file in the root of your package and you
havent defined your own <code>install</code> or <code>preinstall</code> scripts, npm will
haven't defined your own <code>install</code> or <code>preinstall</code> scripts, npm will
default the <code>install</code> command to compile using node-gyp via <code>node-gyp rebuild</code></p>
<p>These are run from the scripts of <code>&lt;pkg-name&gt;</code></p>
<h4 id="npm-pack"><a href="../commands/npm-pack.html"><code>npm pack</code></a></h4>
@ -338,7 +339,7 @@ will default the <code>start</code> command to <code>node server.js</code>. <co
<li><code>posttest</code></li>
</ul>
<h4 id="a-note-on-a-lack-of-npm-uninstall-scripts">A Note on a lack of <a href="../commands/npm-uninstall.html"><code>npm uninstall</code></a> scripts</h4>
<p>While npm v6 had <code>uninstall</code> lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and theres no clear way to currently give the script enough context to be useful.</p>
<p>While npm v6 had <code>uninstall</code> lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful.</p>
<p>Reasons for a package removal include:</p>
<ul>
<li>a user directly uninstalled this package</li>
@ -375,8 +376,8 @@ exported into the <code>node_modules/.bin</code> directory on <code>npm install<
<p>The package.json fields are tacked onto the <code>npm_package_</code> prefix. So,
for instance, if you had <code>{"name":"foo", "version":"1.2.5"}</code> in your
package.json file, then your package scripts would have the
<code>npm_package_name</code> environment variable set to “foo”, and the
<code>npm_package_version</code> set to “1.2.5”. You can access these variables
<code>npm_package_name</code> environment variable set to "foo", and the
<code>npm_package_version</code> set to "1.2.5". You can access these variables
in your code with <code>process.env.npm_package_name</code> and
<code>process.env.npm_package_version</code>, and so on for other fields.</p>
<p>See <a href="../configuring-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
@ -384,9 +385,9 @@ in your code with <code>process.env.npm_package_name</code> and
<p>Lastly, the <code>npm_lifecycle_event</code> environment variable is set to
whichever stage of the cycle is being executed. So, you could have a
single script used for different parts of the process which switches
based on whats currently happening.</p>
based on what's currently happening.</p>
<p>Objects are flattened following this format, so if you had
<code>{"scripts":{"install":"foo.js"}}</code> in your package.json, then youd
<code>{"scripts":{"install":"foo.js"}}</code> in your package.json, then you'd
see this in the script:</p>
<pre lang="bash"><code>process.env.npm_package_scripts_install === "foo.js"
</code></pre>
@ -420,15 +421,15 @@ fine:</p>
<p>Scripts are run by passing the line as a script argument to <code>sh</code>.</p>
<p>If the script exits with a code other than 0, then this will abort the
process.</p>
<p>Note that these script files dont have to be Node.js or even
<p>Note that these script files don't have to be Node.js or even
JavaScript programs. They just have to be some kind of executable
file.</p>
<h3 id="best-practices">Best Practices</h3>
<ul>
<li>Dont exit with a non-zero error code unless you <em>really</em> mean it.
<li>Don't exit with a non-zero error code unless you <em>really</em> mean it.
Except for uninstall scripts, this will cause the npm action to
fail, and potentially be rolled back. If the failure is minor or
only will prevent some optional features, then its better to just
only will prevent some optional features, then it's better to just
print a warning and exit successfully.</li>
<li>Try not to use scripts to do what npm can do for you. Read through
<a href="../configuring-npm/package-json.html"><code>package.json</code></a> to see all the things that you can specify and enable
@ -436,12 +437,12 @@ by simply describing your package appropriately. In general, this
will lead to a more robust and consistent state.</li>
<li>Inspect the env to determine where to put things. For instance, if
the <code>npm_config_binroot</code> environment variable is set to <code>/home/user/bin</code>, then
dont try to install executables into <code>/usr/local/bin</code>. The user
don't try to install executables into <code>/usr/local/bin</code>. The user
probably set it up that way for a reason.</li>
<li>Dont prefix your script commands with “sudo”. If root permissions
are required for some reason, then itll fail with that error, and
<li>Don't prefix your script commands with "sudo". If root permissions
are required for some reason, then it'll fail with that error, and
the user will sudo the npm command in question.</li>
<li>Dont use <code>install</code>. Use a <code>.gyp</code> file for compilation, and <code>prepublish</code>
<li>Don't use <code>install</code>. Use a <code>.gyp</code> file for compilation, and <code>prepublish</code>
for anything else. You should almost never have to explicitly set a
preinstall or install script. If you are doing this, please consider if
there is another option. The only valid use of <code>install</code> or <code>preinstall</code>

View File

@ -1,4 +1,5 @@
<html><head>
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<title>workspaces</title>
<style>
body {
@ -154,7 +155,7 @@ as part of <code>npm install</code> and avoiding manually having to use <code>np
order to add references to packages that should be symlinked into the current
<code>node_modules</code> folder.</p>
<p>We also refer to these packages being auto-symlinked during <code>npm install</code> as a
single <strong>workspace</strong>, meaning its a nested package within the current local
single <strong>workspace</strong>, meaning it's a nested package within the current local
file system that is explicitly defined in the <a href="../configuring-npm/package-json#workspaces.html"><code>package.json</code></a>
<code>workspaces</code> configuration.</p>
<h3 id="defining-workspaces">Defining workspaces</h3>
@ -198,7 +199,7 @@ structure of files and folders:</p>
file (if needed) while also making sure to properly configure the
<code>"workspaces"</code> property of your root project <code>package.json</code>.</p>
<h3 id="adding-dependencies-to-a-workspace">Adding dependencies to a workspace</h3>
<p>Its possible to directly add/remove/update dependencies of your workspaces
<p>It's possible to directly add/remove/update dependencies of your workspaces
using the <a href="../using-npm/config#workspace.html"><code>workspace</code> config</a>.</p>
<p>For example, assuming the following structure:</p>
<pre><code>.
@ -218,9 +219,9 @@ workspace:</p>
<p>Note: other installing commands such as <code>uninstall</code>, <code>ci</code>, etc will also
respect the provided <code>workspace</code> configuration.</p>
<h3 id="using-workspaces">Using workspaces</h3>
<p>Given the <a href="https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together">specifities of how Node.js handles module resolution</a> its possible to consume any defined workspace
<p>Given the <a href="https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together">specifities of how Node.js handles module resolution</a> it's possible to consume any defined workspace
by its declared <code>package.json</code> <code>name</code>. Continuing from the example defined
above, lets also create a Node.js script that will require the <code>workspace-a</code>
above, let's also create a Node.js script that will require the <code>workspace-a</code>
example module, e.g:</p>
<pre><code>// ./workspace-a/index.js
module.exports = 'a'
@ -248,7 +249,7 @@ of nested workspaces. For a project containing multiple workspaces, e.g:</p>
`-- b
`-- package.json
</code></pre>
<p>By running a command using the <code>workspace</code> option, its possible to run the
<p>By running a command using the <code>workspace</code> option, it's possible to run the
given command in the context of that specific workspace. e.g:</p>
<pre><code>npm run test --workspace=a
</code></pre>
@ -258,7 +259,7 @@ given command in the context of that specific workspace. e.g:</p>
command-line in order to target multiple workspaces, e.g:</p>
<pre><code>npm run test --workspace=a --workspace=b
</code></pre>
<p>Its also possible to use the <code>workspaces</code> (plural) configuration option to
<p>It's also possible to use the <code>workspaces</code> (plural) configuration option to
enable the same behavior but running that command in the context of <strong>all</strong>
configured workspaces. e.g:</p>
<pre><code>npm run test --workspaces

5
deps/npm/index.js vendored
View File

@ -1,4 +1,5 @@
if (require.main === module)
if (require.main === module) {
require('./lib/cli.js')(process)
else
} else {
throw new Error('The programmatic API was removed in npm v8.0.0')
}

View File

@ -8,14 +8,11 @@ class ArboristCmd extends BaseCommand {
return true
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static params = [
'workspace',
'workspaces',
'include-workspace-root',
]
}
async execWorkspaces (args, filters) {
await this.setWorkspaces(filters)

View File

@ -40,11 +40,12 @@ const login = async (npm, opts) => {
opts
)
} catch (err) {
if (err.code === 'EOTP')
if (err.code === 'EOTP') {
newUser = await requestOTP()
else
} else {
throw err
}
}
return newUser
}
@ -58,20 +59,20 @@ const login = async (npm, opts) => {
opts.creds.username &&
opts.creds.password &&
opts.creds.email)
if (err.code === 'EOTP')
if (err.code === 'EOTP') {
res = await requestOTP()
else if (needsMoreInfo)
} else if (needsMoreInfo) {
throw err
else {
} else {
// TODO: maybe this needs to check for err.code === 'E400' instead?
res = await addNewUser()
}
}
const newCreds = {}
if (res && res.token)
if (res && res.token) {
newCreds.token = res.token
else {
} else {
newCreds.username = opts.creds.username
newCreds.password = opts.creds.password
newCreds.email = opts.creds.email

View File

@ -25,9 +25,10 @@ const pollForSession = ({ registry, token, opts }) => {
return sleep(opts.ssoPollFrequency).then(() => {
return pollForSession({ registry, token, opts })
})
} else
} else {
throw err
}
}
)
}
@ -41,8 +42,9 @@ const login = async (npm, { creds, registry, scope }) => {
const opts = { ...npm.flatOptions, creds, registry, scope }
const { ssoType } = opts
if (!ssoType)
if (!ssoType) {
throw new Error('Missing option: sso-type')
}
// We're reusing the legacy login endpoint, so we need some dummy
// stuff here to pass validation. They're never used.
@ -57,10 +59,12 @@ const login = async (npm, { creds, registry, scope }) => {
opts => profile.loginCouch(auth.username, auth.password, opts)
)
if (!token)
if (!token) {
throw new Error('no SSO token returned')
if (!sso)
}
if (!sso) {
throw new Error('no SSO URL returned by services')
}
await openUrl(npm, sso, 'to complete your login please visit')

View File

@ -19,17 +19,22 @@ class BaseCommand {
get usage () {
let usage = `npm ${this.constructor.name}\n\n`
if (this.constructor.description)
if (this.constructor.description) {
usage = `${usage}${this.constructor.description}\n\n`
}
usage = `${usage}Usage:\n`
if (!this.constructor.usage)
if (!this.constructor.usage) {
usage = `${usage}npm ${this.constructor.name}`
else
usage = `${usage}${this.constructor.usage.map(u => `npm ${this.constructor.name} ${u}`).join('\n')}`
} else {
usage = `${usage}${this.constructor.usage
.map(u => `npm ${this.constructor.name} ${u}`)
.join('\n')}`
}
if (this.constructor.params)
if (this.constructor.params) {
usage = `${usage}\n\nOptions:\n${this.wrappedParams}`
}
// Mostly this just appends aliases, this could be more clear
usage = usageUtil(this.constructor.name, usage)
@ -43,7 +48,7 @@ class BaseCommand {
for (const param of this.constructor.params) {
const usage = `[${ConfigDefinitions[param].usage}]`
if (line.length && (line.length + usage.length) > this.wrapWidth) {
if (line.length && line.length + usage.length > this.wrapWidth) {
results = [results, line].filter(Boolean).join('\n')
line = ''
}
@ -54,23 +59,24 @@ class BaseCommand {
}
usageError (prefix = '') {
if (prefix)
if (prefix) {
prefix += '\n\n'
}
return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
code: 'EUSAGE',
})
}
async execWorkspaces (args, filters) {
throw Object.assign(
new Error('This command does not support workspaces.'),
{ code: 'ENOWORKSPACES' }
)
throw Object.assign(new Error('This command does not support workspaces.'), {
code: 'ENOWORKSPACES',
})
}
async setWorkspaces (filters) {
if (this.isArboristCmd)
if (this.isArboristCmd) {
this.includeWorkspaceRoot = false
}
const ws = await getWorkspaces(filters, {
path: this.npm.localPrefix,

13
deps/npm/lib/cli.js vendored
View File

@ -1,13 +1,10 @@
// Separated out for easier unit testing
module.exports = async (process) => {
module.exports = async process => {
// set it here so that regardless of what happens later, we don't
// leak any private CLI configs to other programs
process.title = 'npm'
const {
checkForBrokenNode,
checkForUnsupportedNode,
} = require('../lib/utils/unsupported.js')
const { checkForBrokenNode, checkForUnsupportedNode } = require('../lib/utils/unsupported.js')
checkForBrokenNode()
@ -25,8 +22,9 @@ module.exports = async (process) => {
// if npm is called as "npmg" or "npm_g", then
// run in global mode.
if (process.argv[1][process.argv[1].length - 1] === 'g')
if (process.argv[1][process.argv[1].length - 1] === 'g') {
process.argv.splice(1, 1, 'npm', '-g')
}
const replaceInfo = require('../lib/utils/replace-info.js')
log.verbose('cli', replaceInfo(process.argv))
@ -70,7 +68,8 @@ module.exports = async (process) => {
if (err.code === 'EUNKNOWNCOMMAND') {
const didYouMean = require('./utils/did-you-mean.js')
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`)
npm.output(`Unknown command: "${cmd}"${suggestions}\n`)
npm.output('To see a list of supported npm commands, run:\n npm help')
process.exitCode = 1
return exitHandler()
}

View File

@ -20,24 +20,14 @@ const subcommands = [
]
class Access extends BaseCommand {
static get description () {
return 'Set access level on published packages'
}
static get name () {
return 'access'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static description = 'Set access level on published packages'
static name = 'access'
static params = [
'registry',
'otp',
]
}
static get usage () {
return [
static usage = [
'public [<package>]',
'restricted [<package>]',
'grant <read-only|read-write> <scope:team> [<package>]',
@ -48,19 +38,20 @@ class Access extends BaseCommand {
'ls-collaborators [<package> [<user>]]',
'edit [<package>]',
]
}
async completion (opts) {
const argv = opts.conf.argv.remain
if (argv.length === 2)
if (argv.length === 2) {
return subcommands
}
switch (argv[2]) {
case 'grant':
if (argv.length === 3)
if (argv.length === 3) {
return ['read-only', 'read-write']
else
} else {
return []
}
case 'public':
case 'restricted':
@ -77,11 +68,13 @@ class Access extends BaseCommand {
}
async exec ([cmd, ...args]) {
if (!cmd)
if (!cmd) {
throw this.usageError('Subcommand is required.')
}
if (!subcommands.includes(cmd) || !this[cmd])
if (!subcommands.includes(cmd) || !this[cmd]) {
throw this.usageError(`${cmd} is not a recognized subcommand.`)
}
return this[cmd](args, this.npm.flatOptions)
}
@ -95,11 +88,13 @@ class Access extends BaseCommand {
}
async grant ([perms, scopeteam, pkg], opts) {
if (!perms || (perms !== 'read-only' && perms !== 'read-write'))
if (!perms || (perms !== 'read-only' && perms !== 'read-write')) {
throw this.usageError('First argument must be either `read-only` or `read-write`.')
}
if (!scopeteam)
if (!scopeteam) {
throw this.usageError('`<scope:team>` argument is required.')
}
const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
@ -115,8 +110,9 @@ class Access extends BaseCommand {
}
async revoke ([scopeteam, pkg], opts) {
if (!scopeteam)
if (!scopeteam) {
throw this.usageError('`<scope:team>` argument is required.')
}
const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
@ -152,8 +148,9 @@ class Access extends BaseCommand {
}
async lsPackages ([owner], opts) {
if (!owner)
if (!owner) {
owner = await getIdentity(this.npm, opts)
}
const pkgs = await libaccess.lsPackages(owner, opts)
@ -183,9 +180,9 @@ class Access extends BaseCommand {
}
async getPackage (name, requireScope) {
if (name && name.trim())
if (name && name.trim()) {
return name.trim()
else {
} else {
try {
const pkg = await readPackageJson(path.resolve(this.npm.prefix, 'package.json'))
name = pkg.name
@ -194,16 +191,18 @@ class Access extends BaseCommand {
throw new Error(
'no package name passed to command and no package.json found'
)
} else
} else {
throw err
}
}
if (requireScope && !name.match(/^@[^/]+\/.*$/))
if (requireScope && !name.match(/^@[^/]+\/.*$/)) {
throw this.usageError('This command is only available for scoped packages.')
else
} else {
return name
}
}
}
}
module.exports = Access

View File

@ -9,20 +9,12 @@ const authTypes = {
}
class AddUser extends BaseCommand {
static get description () {
return 'Add a registry user account'
}
static get name () {
return 'adduser'
}
static get params () {
return [
static description = 'Add a registry user account'
static name = 'adduser'
static params = [
'registry',
'scope',
]
}
async exec (args) {
const { scope } = this.npm.flatOptions
@ -54,17 +46,19 @@ class AddUser extends BaseCommand {
if (scope) {
const scopedRegistry = this.npm.config.get(`${scope}:registry`)
const cliRegistry = this.npm.config.get('registry', 'cli')
if (scopedRegistry && !cliRegistry)
if (scopedRegistry && !cliRegistry) {
return scopedRegistry
}
}
return registry
}
getAuthType ({ authType }) {
const type = authTypes[authType]
if (!type)
if (!type) {
throw new Error('no such auth module')
}
return type
}
@ -72,8 +66,9 @@ class AddUser extends BaseCommand {
async updateConfig ({ newCreds, registry, scope }) {
this.npm.config.delete('_token', 'user') // prevent legacy pollution
this.npm.config.setCredentialsByURI(registry, newCreds)
if (scope)
if (scope) {
this.npm.config.set(scope + ':registry', registry, 'user')
}
await this.npm.config.save('user')
}
}

View File

@ -5,19 +5,9 @@ const auditError = require('../utils/audit-error.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Audit extends ArboristWorkspaceCmd {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Run a security audit'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'audit'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static description = 'Run a security audit'
static name = 'audit'
static params = [
'audit-level',
'dry-run',
'force',
@ -26,18 +16,15 @@ class Audit extends ArboristWorkspaceCmd {
'omit',
...super.params,
]
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
return ['[fix]']
}
static usage = ['[fix]']
async completion (opts) {
const argv = opts.conf.argv.remain
if (argv.length === 2)
if (argv.length === 2) {
return ['fix']
}
switch (argv[2]) {
case 'fix':
@ -60,9 +47,9 @@ class Audit extends ArboristWorkspaceCmd {
const arb = new Arborist(opts)
const fix = args[0] === 'fix'
await arb.audit({ fix })
if (fix)
if (fix) {
await reifyFinish(this.npm, arb)
else {
} else {
// will throw if there's an error, because this is an audit command
auditError(this.npm, arb.auditReport)
const result = auditReport(arb.auditReport, opts)

View File

@ -2,23 +2,16 @@ const envPath = require('../utils/path.js')
const BaseCommand = require('../base-command.js')
class Bin extends BaseCommand {
static get description () {
return 'Display npm bin folder'
}
static get name () {
return 'bin'
}
static get params () {
return ['global']
}
static description = 'Display npm bin folder'
static name = 'bin'
static params = ['global']
async exec (args) {
const b = this.npm.bin
this.npm.output(b)
if (this.npm.config.get('global') && !envPath.includes(b))
if (this.npm.config.get('global') && !envPath.includes(b)) {
console.error('(not in PATH env variable)')
}
}
}
module.exports = Bin

View File

@ -1,11 +1,10 @@
const BaseCommand = require('../base-command.js')
class Birthday extends BaseCommand {
static name = 'birthday'
async exec () {
this.npm.config.set('package', ['@npmcli/npm-birthday'])
this.npm.config.set('yes', true)
const exec = await this.npm.cmd('exec')
return exec.exec(['npm-birthday'])
return this.npm.exec('exec', ['@npmcli/npm-birthday'])
}
}

View File

@ -5,26 +5,15 @@ const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
const BaseCommand = require('../base-command.js')
class Bugs extends BaseCommand {
static get description () {
return 'Report bugs for a package in a web browser'
}
static get name () {
return 'bugs'
}
static get usage () {
return ['[<pkgname>]']
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return ['browser', 'registry']
}
static description = 'Report bugs for a package in a web browser'
static name = 'bugs'
static usage = ['[<pkgname>]']
static params = ['browser', 'registry']
async exec (args) {
if (!args || !args.length)
if (!args || !args.length) {
args = ['.']
}
await Promise.all(args.map(pkg => this.getBugs(pkg)))
}
@ -39,20 +28,24 @@ class Bugs extends BaseCommand {
getBugsUrl (mani) {
if (mani.bugs) {
if (typeof mani.bugs === 'string')
if (typeof mani.bugs === 'string') {
return mani.bugs
}
if (typeof mani.bugs === 'object' && mani.bugs.url)
if (typeof mani.bugs === 'object' && mani.bugs.url) {
return mani.bugs.url
}
if (typeof mani.bugs === 'object' && mani.bugs.email)
if (typeof mani.bugs === 'object' && mani.bugs.email) {
return `mailto:${mani.bugs.email}`
}
}
// try to get it from the repo, if possible
const info = hostedFromMani(mani)
if (info)
if (info) {
return info.bugs()
}
// just send them to the website, hopefully that has some info!
return `https://www.npmjs.com/package/${mani.name}`

View File

@ -12,8 +12,10 @@ const localeCompare = require('@isaacs/string-locale-compare')('en')
const searchCachePackage = async (path, spec, cacheKeys) => {
const parsed = npa(spec)
if (parsed.rawSpec !== '' && parsed.type === 'tag')
if (parsed.rawSpec !== '' && parsed.type === 'tag') {
throw new Error(`Cannot list cache keys for a tagged package.`)
}
/* eslint-disable-next-line max-len */
const searchMFH = new RegExp(`^make-fetch-happen:request-cache:.*(?<!/[@a-zA-Z]+)/${parsed.name}/-/(${parsed.name}[^/]+.tgz)$`)
const searchPack = new RegExp(`^make-fetch-happen:request-cache:.*/${parsed.escapedName}$`)
const results = new Set()
@ -26,13 +28,15 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
const noExt = filename.slice(0, -4)
const noScope = `${parsed.name.split('/').pop()}-`
const ver = noExt.slice(noScope.length)
if (semver.satisfies(ver, parsed.rawSpec))
if (semver.satisfies(ver, parsed.rawSpec)) {
results.add(key)
}
continue
}
// is this key a packument?
if (!searchPack.test(key))
if (!searchPack.test(key)) {
continue
}
results.add(key)
let packument, details
@ -43,40 +47,30 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
// if we couldn't parse the packument, abort
continue
}
if (!packument.versions || typeof packument.versions !== 'object')
if (!packument.versions || typeof packument.versions !== 'object') {
continue
}
// assuming this is a packument
for (const ver of Object.keys(packument.versions)) {
if (semver.satisfies(ver, parsed.rawSpec)) {
if (packument.versions[ver].dist
&& typeof packument.versions[ver].dist === 'object'
&& packument.versions[ver].dist.tarball !== undefined
&& cacheKeys.has(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`))
if (packument.versions[ver].dist &&
typeof packument.versions[ver].dist === 'object' &&
packument.versions[ver].dist.tarball !== undefined &&
cacheKeys.has(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`)
) {
results.add(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`)
}
}
}
}
return results
}
class Cache extends BaseCommand {
static get description () {
return 'Manipulates packages cache'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'cache'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return ['cache']
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
return [
static description = 'Manipulates packages cache'
static name = 'cache'
static params = ['cache']
static usage = [
'add <tarball file>',
'add <folder>',
'add <tarball url>',
@ -86,12 +80,12 @@ class Cache extends BaseCommand {
'ls [<name>@<version>]',
'verify',
]
}
async completion (opts) {
const argv = opts.conf.argv.remain
if (argv.length === 2)
if (argv.length === 2) {
return ['add', 'clean', 'verify', 'ls', 'delete']
}
// TODO - eventually...
switch (argv[2]) {
@ -162,8 +156,9 @@ class Cache extends BaseCommand {
// npm cache add <folder>...
async add (args) {
log.silly('cache add', 'args', args)
if (args.length === 0)
if (args.length === 0) {
throw this.usageError('First argument to `add` is required')
}
return Promise.all(args.map(spec => {
log.silly('cache add', 'spec', spec)
@ -185,9 +180,16 @@ class Cache extends BaseCommand {
const stats = await cacache.verify(cache)
this.npm.output(`Cache verified and compressed (${prefix})`)
this.npm.output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
stats.badContentCount && this.npm.output(`Corrupted content removed: ${stats.badContentCount}`)
stats.reclaimedCount && this.npm.output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
stats.missingContent && this.npm.output(`Missing content: ${stats.missingContent}`)
if (stats.badContentCount) {
this.npm.output(`Corrupted content removed: ${stats.badContentCount}`)
}
if (stats.reclaimedCount) {
/* eslint-disable-next-line max-len */
this.npm.output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
}
if (stats.missingContent) {
this.npm.output(`Missing content: ${stats.missingContent}`)
}
this.npm.output(`Index entries: ${stats.totalEntries}`)
this.npm.output(`Finished in ${stats.runTime.total / 1000}s`)
}
@ -201,9 +203,10 @@ class Cache extends BaseCommand {
const results = new Set()
for (const spec of specs) {
const keySet = await searchCachePackage(cachePath, spec, cacheKeys)
for (const key of keySet)
for (const key of keySet) {
results.add(key)
}
}
[...results].sort(localeCompare).forEach(key => this.npm.output(key))
return
}

View File

@ -20,24 +20,13 @@ const removeNodeModules = async where => {
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class CI extends ArboristWorkspaceCmd {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Install a project with a clean slate'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'ci'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static description = 'Install a project with a clean slate'
static name = 'ci'
static params = [
'audit',
'ignore-scripts',
'script-shell',
]
}
async exec () {
if (this.npm.config.get('global')) {

View File

@ -45,20 +45,14 @@ const { promisify } = require('util')
const BaseCommand = require('../base-command.js')
class Completion extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Tab Completion for npm'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'completion'
}
static description = 'Tab Completion for npm'
static name = 'completion'
// completion for the completion command
async completion (opts) {
if (opts.w > 2)
if (opts.w > 2) {
return
}
const { resolve } = require('path')
const [bashExists, zshExists] = await Promise.all([
@ -66,11 +60,13 @@ class Completion extends BaseCommand {
fileExists(resolve(process.env.HOME, '.zshrc')),
])
const out = []
if (zshExists)
if (zshExists) {
out.push(['>>', '~/.zshrc'])
}
if (bashExists)
if (bashExists) {
out.push(['>>', '~/.bashrc'])
}
return out
}
@ -88,8 +84,9 @@ class Completion extends BaseCommand {
// if the COMP_* isn't in the env, then just dump the script.
if (COMP_CWORD === undefined ||
COMP_LINE === undefined ||
COMP_POINT === undefined)
COMP_POINT === undefined) {
return dumpScript()
}
// ok we're actually looking at the envs and outputting the suggestions
// get the partial line and partial word,
@ -106,8 +103,9 @@ class Completion extends BaseCommand {
// figure out where in that last word the point is.
const partialWordRaw = args[w]
let i = partialWordRaw.length
while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0)
while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
i--
}
const partialWord = unescape(partialWordRaw.substr(0, i))
partialWords.push(partialWord)
@ -126,8 +124,9 @@ class Completion extends BaseCommand {
}
if (partialWords.slice(0, -1).indexOf('--') === -1) {
if (word.charAt(0) === '-')
if (word.charAt(0) === '-') {
return this.wrap(opts, configCompl(opts))
}
if (words[w - 1] &&
words[w - 1].charAt(0) === '-' &&
@ -151,15 +150,16 @@ class Completion extends BaseCommand {
nopt(types, shorthands, partialWords.slice(0, -1), 0)
// check if there's a command already.
const cmd = parsed.argv.remain[1]
if (!cmd)
if (!cmd) {
return this.wrap(opts, cmdCompl(opts))
}
Object.keys(parsed).forEach(k => this.npm.config.set(k, parsed[k]))
// at this point, if words[1] is some kind of npm command,
// then complete on it.
// otherwise, do nothing
const impl = this.npm.cmd(cmd)
const impl = await this.npm.cmd(cmd)
if (impl.completion) {
const comps = await impl.completion(opts)
return this.wrap(opts, comps)
@ -173,19 +173,20 @@ class Completion extends BaseCommand {
// Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand
// to: 'a', 'b c', or 'd' 'e'
wrap (opts, compls) {
if (!Array.isArray(compls))
compls = compls ? [compls] : []
// TODO this was dead code, leaving it in case we find some command we
// forgot that requires this. if so *that command should fix its
// completions*
// compls = compls.map(w => !/\s+/.test(w) ? w : '\'' + w + '\'')
compls = compls.map(c =>
Array.isArray(c) ? c.map(escape).join(' ') : escape(c))
if (opts.partialWord)
if (opts.partialWord) {
compls = compls.filter(c => c.startsWith(opts.partialWord))
}
if (compls.length > 0)
if (compls.length > 0) {
this.npm.output(compls.join('\n'))
}
}
}
const dumpScript = async () => {
const fs = require('fs')
@ -197,8 +198,9 @@ const dumpScript = async () => {
await new Promise((res, rej) => {
let done = false
process.stdout.on('error', er => {
if (done)
if (done) {
return
}
done = true
@ -214,15 +216,17 @@ const dumpScript = async () => {
// can never ever work on OS X.
// TODO Ignoring coverage, see 'non EPIPE errors cause failures' test.
/* istanbul ignore next */
if (er.errno === 'EPIPE')
if (er.errno === 'EPIPE') {
res()
else
} else {
rej(er)
}
})
process.stdout.write(d, () => {
if (done)
if (done) {
return
}
done = true
res()
@ -233,9 +237,6 @@ const dumpScript = async () => {
const unescape = w => w.charAt(0) === '\'' ? w.replace(/^'|'$/g, '')
: w.replace(/\\ /g, ' ')
const escape = w => !/\s+/.test(w) ? w
: '\'' + w + '\''
// the current word has a dash. Return the config names,
// with the same number of dashes as the current word has.
const configCompl = opts => {
@ -269,12 +270,14 @@ const isFlag = word => {
// if they all resolve to the same thing, just return the thing it already is
const cmdCompl = opts => {
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
if (!matches.length)
if (!matches.length) {
return matches
}
const derefs = new Set([...matches.map(c => deref(c))])
if (derefs.size === 1)
if (derefs.size === 1) {
return [...derefs]
}
return fullList
}

View File

@ -31,46 +31,35 @@ const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k)
const BaseCommand = require('../base-command.js')
class Config extends BaseCommand {
static get description () {
return 'Manage the npm configuration files'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'config'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
return [
static description = 'Manage the npm configuration files'
static name = 'config'
static usage = [
'set <key>=<value> [<key>=<value> ...]',
'get [<key> [<key> ...]]',
'delete <key> [<key> ...]',
'list [--json]',
'edit',
]
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static params = [
'json',
'global',
'editor',
'location',
'long',
]
}
async completion (opts) {
const argv = opts.conf.argv.remain
if (argv[1] !== 'config')
if (argv[1] !== 'config') {
argv.unshift('config')
}
if (argv.length === 2) {
const cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit']
if (opts.partialWord !== 'l')
if (opts.partialWord !== 'l') {
cmds.push('list')
}
return cmds
}
@ -79,8 +68,9 @@ class Config extends BaseCommand {
switch (action) {
case 'set':
// todo: complete with valid values, if possible.
if (argv.length > 3)
if (argv.length > 3) {
return []
}
// fallthrough
/* eslint no-fallthrough:0 */
@ -132,28 +122,32 @@ class Config extends BaseCommand {
}
async set (args) {
if (!args.length)
if (!args.length) {
throw this.usageError()
}
const where = this.npm.flatOptions.location
for (const [key, val] of Object.entries(keyValues(args))) {
this.npm.log.info('config', 'set %j %j', key, val)
this.npm.config.set(key, val || '', where)
if (!this.npm.config.validate(where))
if (!this.npm.config.validate(where)) {
this.npm.log.warn('config', 'omitting invalid config values')
}
}
await this.npm.config.save(where)
}
async get (keys) {
if (!keys.length)
if (!keys.length) {
return this.list()
}
const out = []
for (const key of keys) {
if (!publicVar(key))
if (!publicVar(key)) {
throw `The ${key} option is protected, and cannot be retrieved in this way`
}
const pref = keys.length > 1 ? `${key}=` : ''
out.push(pref + this.npm.config.get(key))
@ -162,12 +156,14 @@ class Config extends BaseCommand {
}
async del (keys) {
if (!keys.length)
if (!keys.length) {
throw this.usageError()
}
const where = this.npm.flatOptions.location
for (const key of keys)
for (const key of keys) {
this.npm.config.delete(key, where)
}
await this.npm.config.save(where)
}
@ -220,8 +216,9 @@ ${defData}
const [bin, ...args] = e.split(/\s+/)
const editor = spawn(bin, [...args, file], { stdio: 'inherit' })
editor.on('exit', (code) => {
if (code)
if (code) {
return reject(new Error(`editor process exited with code: ${code}`))
}
return resolve()
})
})
@ -232,12 +229,14 @@ ${defData}
// long does not have a flattener
const long = this.npm.config.get('long')
for (const [where, { data, source }] of this.npm.config.data.entries()) {
if (where === 'default' && !long)
if (where === 'default' && !long) {
continue
}
const keys = Object.keys(data).sort(localeCompare)
if (!keys.length)
if (!keys.length) {
continue
}
msg.push(`; "${where}" config from ${source}`, '')
for (const k of keys) {
@ -265,8 +264,9 @@ ${defData}
async listJson () {
const publicConf = {}
for (const key in this.npm.config.list[0]) {
if (!publicVar(key))
if (!publicVar(key)) {
continue
}
publicConf[key] = this.npm.config.get(key)
}

View File

@ -5,19 +5,9 @@ const reifyFinish = require('../utils/reify-finish.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Dedupe extends ArboristWorkspaceCmd {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Reduce duplication in the package tree'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'dedupe'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static description = 'Reduce duplication in the package tree'
static name = 'dedupe'
static params = [
'global-style',
'legacy-bundling',
'strict-peer-deps',
@ -30,7 +20,6 @@ class Dedupe extends ArboristWorkspaceCmd {
'dry-run',
...super.params,
]
}
async exec (args) {
if (this.npm.config.get('global')) {

View File

@ -7,31 +7,18 @@ const libaccess = require('libnpmaccess')
const BaseCommand = require('../base-command.js')
class Deprecate extends BaseCommand {
static get description () {
return 'Deprecate a version of a package'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'deprecate'
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
return ['<pkg>[@<version>] <message>']
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
static description = 'Deprecate a version of a package'
static name = 'deprecate'
static usage = ['<pkg>[@<version>] <message>']
static params = [
'registry',
'otp',
]
}
async completion (opts) {
if (opts.conf.argv.remain.length > 1)
if (opts.conf.argv.remain.length > 1) {
return []
}
const username = await getIdentity(this.npm, this.npm.flatOptions)
const packages = await libaccess.lsPackages(username, this.npm.flatOptions)
@ -44,8 +31,9 @@ class Deprecate extends BaseCommand {
async exec ([pkg, msg]) {
// msg == null because '' is a valid value, it indicates undeprecate
if (!pkg || msg == null)
if (!pkg || msg == null) {
throw this.usageError()
}
// fetch the data and make sure it exists.
const p = npa(pkg)
@ -53,8 +41,9 @@ class Deprecate extends BaseCommand {
// "*" is the appropriate default.
const spec = p.rawSpec === '' ? '*' : p.fetchSpec
if (semver.validRange(spec, true) === null)
if (semver.validRange(spec, true) === null) {
throw new Error(`invalid version range: ${spec}`)
}
const uri = '/' + p.escapedName
const packument = await fetch.json(uri, {

Some files were not shown because too many files have changed in this diff Show More