This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>This command installs a package, and any packages that it depends on. If the
package has a shrinkwrap file, the installation of dependencies will be driven
by that. See <ahref="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a>.</p>
by that. See <ahref="../cli/npm-shrinkwrap.html"><ahref="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></a>.</p>
<p>A <code>package</code> is:</p>
<ul>
<li>a) a folder containing a program described by a package.json file</li>
<li>b) a gzipped tarball containing (a)</li>
<li>c) a url that resolves to (b)</li>
<li>d) a <code><name>@<version></code> that is published on the registry (see <code><ahref="../misc/npm-registry.html">npm-registry(7)</a></code>) with (c)</li>
<li>d) a <code><name>@<version></code> that is published on the registry (see <code><ahref="../misc/npm-registry.html"><ahref="../misc/npm-registry.html">npm-registry(7)</a></a></code>) with (c)</li>
<li>e) a <code><name>@<tag></code> that points to (d)</li>
<li>f) a <code><name></code> that has a "latest" tag satisfying (e)</li>
<li>g) a <code><git remote url></code> that resolves to (b)</li>
<p> In most cases, this will install the latest version
of the module published on npm.</p>
<p> Example:</p>
@@ -87,7 +87,7 @@ <h2 id="synopsis">SYNOPSIS</h2>
operator.</p>
<p><code><scope></code> is optional. The package will be downloaded from the registry
associated with the specified scope. If no registry is associated with
the given scope the default registry is assumed. See <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code>.</p>
the given scope the default registry is assumed. See <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code>.</p>
<p>Note: if you do not include the @-symbol on your scope name, npm will
interpret this as a GitHub repository instead, see below. Scopes names
<p> Install a version of the package matching the specified version range. This
will follow the same rules for resolving dependencies described in <code><ahref="../files/package.json.html">package.json(5)</a></code>.</p>
will follow the same rules for resolving dependencies described in <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code>.</p>
<p> Note that most version ranges must be put in quotes so that your shell will
shrinkwrap file and use the package.json instead.</p>
<p>The <code>--nodedir=/path/to/node/source</code> argument will allow npm to find the
node source code so that npm can compile native modules.</p>
<p>See <code><ahref="../misc/npm-config.html">npm-config(7)</a></code>. Many of the configuration params have some
<p>See <code><ahref="../misc/npm-config.html"><ahref="../misc/npm-config.html">npm-config(7)</a></a></code>. Many of the configuration params have some
effect on installation, since that's most of what npm does.</p>
<h2id="algorithm">ALGORITHM</h2>
<p>To install a package, npm uses the following algorithm:</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>First, <code>npm link</code> in a package folder will create a globally-installed
symbolic link from <code>prefix/package-name</code> to the current folder (see
<code><ahref="../misc/npm-config.html">npm-config(7)</a></code> for the value of <code>prefix</code>).</p>
<code><ahref="../misc/npm-config.html"><ahref="../misc/npm-config.html">npm-config(7)</a></a></code> for the value of <code>prefix</code>).</p>
<p>Next, in some other location, <code>npm link package-name</code> will create a
symlink from the local <code>node_modules</code> folder to the global symlink.</p>
<p>Note that <code>package-name</code> is taken from <code>package.json</code>,
not from directory name.</p>
<p>The package name can be optionally prefixed with a scope. See <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code>.
<p>The package name can be optionally prefixed with a scope. See <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code>.
The scope must by 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.</p>
</code></pre><p>That is, it first creates a global link, and then links the global
installation target into your project's <code>node_modules</code> folder.</p>
<p>If your linked package is scoped (see <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code>) your link command must
<p>If your linked package is scoped (see <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code>) your link command must
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Publishes a package to the registry so that it can be installed by name.</p>
<p>Publishes a package to the registry so that it can be installed by name. See
<code><ahref="../misc/npm-developers.html"><ahref="../misc/npm-developers.html">npm-developers(7)</a></a></code> for details on what's included in the published package, as
well as details on how the package is built.</p>
<p>By default npm will publish to the public registry. This can be overridden by
specifying a different default registry or using a <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code> in the name
(see <code><ahref="../files/package.json.html">package.json(5)</a></code>).</p>
specifying a different default registry or using a <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code> in the name
(see <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code>).</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li><p><code>--save-optional</code>: Package will be removed from your <code>optionalDependencies</code>.</p>
</li>
</ul>
<p>Scope is optional and follows the usual rules for <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code>.</p>
<p>Scope is optional and follows the usual rules for <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code>.</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Even if a package version is unpublished, that specific name and
version combination can never be reused. In order to publish the
package again, a new version number must be used.</p>
<p>The scope is optional and follows the usual rules for <code><ahref="../misc/npm-scope.html">npm-scope(7)</a></code>.</p>
<p>The scope is optional and follows the usual rules for <code><ahref="../misc/npm-scope.html"><ahref="../misc/npm-scope.html">npm-scope(7)</a></a></code>.</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
</code></pre><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 npm contributors in
the shortened string format. (See <code><ahref="../files/package.json.html">package.json(5)</a></code> for more on this.)</p>
the shortened string format. (See <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code> for more on this.)</p>
<pre><code>npm view npm contributors
</code></pre><p>If a version range is provided, then data will be printed for every
matching version of the package. This will show which version of jsdom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ahref="https://github.com/TooTallNate/node-gyp">the node-gyp repository</a> and
the <ahref="https://github.com/TooTallNate/node-gyp/wiki">node-gyp Wiki</a>.</p>
<h2id="directories">DIRECTORIES</h2>
<p>See <code><ahref="../files/npm-folders.html">npm-folders(5)</a></code> to learn about where npm puts stuff.</p>
<p>See <code><ahref="../files/npm-folders.html"><ahref="../files/npm-folders.html">npm-folders(5)</a></a></code> to learn about where npm puts stuff.</p>
<p>In particular, npm has two modes of operation:</p>
<ul>
<li>global mode:<br>npm installs packages into the install prefix at
<li>Defaults:<br>npm's default configuration options are defined in
lib/utils/config-defs.js. These must not be changed.</li>
</ul>
<p>See <code><ahref="../misc/npm-config.html">npm-config(7)</a></code> for much much more information.</p>
<p>See <code><ahref="../misc/npm-config.html"><ahref="../misc/npm-config.html">npm-config(7)</a></a></code> for much much more information.</p>
<h2id="contributions">CONTRIBUTIONS</h2>
<p>Patches welcome!</p>
<ul>
<li>code:
Read through <code><ahref="../misc/npm-coding-style.html">npm-coding-style(7)</a></code> if you plan to submit code.
Read through <code><ahref="../misc/npm-coding-style.html"><ahref="../misc/npm-coding-style.html">npm-coding-style(7)</a></a></code> if you plan to submit code.
You don't have to agree with it, but you do have to follow it.</li>
<li>docs:
If you find an error in the documentation, edit the appropriate markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Scoped packages are installed the same way, except they are grouped together
in a sub-folder of the relevant <code>node_modules</code> folder with the name of that
scope prefix by the @ symbol, e.g. <code>npm install @myorg/package</code> would place
the package in <code>{prefix}/node_modules/@myorg/package</code>. See <code><ahref="../misc/scopes.html">scopes(7)</a></code> for
the package in <code>{prefix}/node_modules/@myorg/package</code>. See <code><ahref="../misc/scopes.html"><ahref="../misc/scopes.html">scopes(7)</a></a></code> for
more details.</p>
<p>If you wish to <code>require()</code> a package, then install it locally.</p>
<p>When in local mode, man pages are not installed.</p>
<p>Man pages are not installed on Windows systems.</p>
<h3id="cache">Cache</h3>
<p>See <code><ahref="../cli/npm-cache.html">npm-cache(1)</a></code>. Cache files are stored in <code>~/.npm</code> on Posix, or
<p>See <code><ahref="../cli/npm-cache.html"><ahref="../cli/npm-cache.html">npm-cache(1)</a></a></code>. Cache files are stored in <code>~/.npm</code> on Posix, or
<code>~/npm-cache</code> on Windows.</p>
<p>This is controlled by the <code>cache</code> configuration param.</p>
<p>This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re-publish those items that
cannot be found elsewhere. See <code><ahref="../files/package.json.html">package.json(5)</a></code> for more information.</p>
cannot be found elsewhere. See <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code> for more information.</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Scoped packages are installed the same way, except they are grouped together
in a sub-folder of the relevant <code>node_modules</code> folder with the name of that
scope prefix by the @ symbol, e.g. <code>npm install @myorg/package</code> would place
the package in <code>{prefix}/node_modules/@myorg/package</code>. See <code><ahref="../misc/scopes.html">scopes(7)</a></code> for
the package in <code>{prefix}/node_modules/@myorg/package</code>. See <code><ahref="../misc/scopes.html"><ahref="../misc/scopes.html">scopes(7)</a></a></code> for
more details.</p>
<p>If you wish to <code>require()</code> a package, then install it locally.</p>
<p>When in local mode, man pages are not installed.</p>
<p>Man pages are not installed on Windows systems.</p>
<h3id="cache">Cache</h3>
<p>See <code><ahref="../cli/npm-cache.html">npm-cache(1)</a></code>. Cache files are stored in <code>~/.npm</code> on Posix, or
<p>See <code><ahref="../cli/npm-cache.html"><ahref="../cli/npm-cache.html">npm-cache(1)</a></a></code>. Cache files are stored in <code>~/.npm</code> on Posix, or
<code>~/npm-cache</code> on Windows.</p>
<p>This is controlled by the <code>cache</code> configuration param.</p>
<p>This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re-publish those items that
cannot be found elsewhere. See <code><ahref="../files/package.json.html">package.json(5)</a></code> for more information.</p>
cannot be found elsewhere. See <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code> for more information.</p>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>When running scripts (see <code><ahref="../misc/npm-scripts.html">npm-scripts(7)</a></code>) the package.json "config"
<p>When running scripts (see <code><ahref="../misc/npm-scripts.html"><ahref="../misc/npm-scripts.html">npm-scripts(7)</a></a></code>) the package.json "config"
keys are overwritten in the environment if there is a config param of
<code><name>[@<version>]:<key></code>. For example, if the package.json has
this:</p>
@@ -90,7 +90,7 @@ <h2 id="shorthands-and-other-cli-niceties">Shorthands and Other CLI Niceties</h2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>You need to have a <code>package.json</code> file in the root of your project to do
much of anything with npm. That is basically the whole interface.</p>
<p>See <code><ahref="../files/package.json.html">package.json(5)</a></code> for details about what goes in that file. At the very
<p>See <code><ahref="../files/package.json.html"><ahref="../files/package.json.html">package.json(5)</a></a></code> for details about what goes in that file. At the very
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li>Get the author email with <code>npm owner ls <pkgname></code></li>
<li>Email the author, CC <ahref="mailto:support@npmjs.com">support@npmjs.com</a></li>
<li>Email the author, CC <ahref="mailto:support@npmjs.com">support@npmjs.com</a></li>
<li>After a few weeks, if there's no resolution, we'll sort it out.</li>
</ol>
<p>Don't squat on package names. Publish code or move out of the way.</p>
<li>Joe emails Bob, explaining the situation <strong>as respectfully as
possible</strong>, and what he would like to do with the module name. He
adds the npm support staff <ahref="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of
adds the npm support staff <ahref="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of
the email. Mention in the email that Bob can run <code>npm owner add
joe foo</code> to add Joe as an owner of the <code>foo</code> package.</li>
<li>After a reasonable amount of time, if Bob has not responded, or if
Bob and Joe can't come to any sort of resolution, email support
<ahref="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is
<ahref="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is
usually at least 4 weeks, but extra time is allowed around common