11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head>
21cb0ef41Sopenharmony_ci<meta charset="utf-8">
31cb0ef41Sopenharmony_ci<title>npm-link</title>
41cb0ef41Sopenharmony_ci<style>
51cb0ef41Sopenharmony_cibody {
61cb0ef41Sopenharmony_ci    background-color: #ffffff;
71cb0ef41Sopenharmony_ci    color: #24292e;
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci    margin: 0;
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci    line-height: 1.5;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
141cb0ef41Sopenharmony_ci}
151cb0ef41Sopenharmony_ci#rainbar {
161cb0ef41Sopenharmony_ci    height: 10px;
171cb0ef41Sopenharmony_ci    background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff);
181cb0ef41Sopenharmony_ci}
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cia {
211cb0ef41Sopenharmony_ci    text-decoration: none;
221cb0ef41Sopenharmony_ci    color: #0366d6;
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_cia:hover {
251cb0ef41Sopenharmony_ci    text-decoration: underline;
261cb0ef41Sopenharmony_ci}
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cipre {
291cb0ef41Sopenharmony_ci    margin: 1em 0px;
301cb0ef41Sopenharmony_ci    padding: 1em;
311cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
321cb0ef41Sopenharmony_ci    border-radius: 6px;
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci    display: block;
351cb0ef41Sopenharmony_ci    overflow: auto;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci    white-space: pre;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
401cb0ef41Sopenharmony_ci    color: #393a34;
411cb0ef41Sopenharmony_ci}
421cb0ef41Sopenharmony_cicode {
431cb0ef41Sopenharmony_ci    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
441cb0ef41Sopenharmony_ci    font-size: 85%;
451cb0ef41Sopenharmony_ci    padding: 0.2em 0.4em;
461cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
471cb0ef41Sopenharmony_ci    color: #393a34;
481cb0ef41Sopenharmony_ci}
491cb0ef41Sopenharmony_cipre > code {
501cb0ef41Sopenharmony_ci    padding: 0;
511cb0ef41Sopenharmony_ci    background-color: inherit;
521cb0ef41Sopenharmony_ci    color: inherit;
531cb0ef41Sopenharmony_ci}
541cb0ef41Sopenharmony_cih1, h2, h3 {
551cb0ef41Sopenharmony_ci    font-weight: 600;
561cb0ef41Sopenharmony_ci}
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci#logobar {
591cb0ef41Sopenharmony_ci    background-color: #333333;
601cb0ef41Sopenharmony_ci    margin: 0 auto;
611cb0ef41Sopenharmony_ci    padding: 1em 4em;
621cb0ef41Sopenharmony_ci}
631cb0ef41Sopenharmony_ci#logobar .logo {
641cb0ef41Sopenharmony_ci    float: left;
651cb0ef41Sopenharmony_ci}
661cb0ef41Sopenharmony_ci#logobar .title {
671cb0ef41Sopenharmony_ci    font-weight: 600;
681cb0ef41Sopenharmony_ci    color: #dddddd;
691cb0ef41Sopenharmony_ci    float: left;
701cb0ef41Sopenharmony_ci    margin: 5px 0 0 1em;
711cb0ef41Sopenharmony_ci}
721cb0ef41Sopenharmony_ci#logobar:after {
731cb0ef41Sopenharmony_ci    content: "";
741cb0ef41Sopenharmony_ci    display: block;
751cb0ef41Sopenharmony_ci    clear: both;
761cb0ef41Sopenharmony_ci}
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ci#content {
791cb0ef41Sopenharmony_ci    margin: 0 auto;
801cb0ef41Sopenharmony_ci    padding: 0 4em;
811cb0ef41Sopenharmony_ci}
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci#table_of_contents > h2 {
841cb0ef41Sopenharmony_ci    font-size: 1.17em;
851cb0ef41Sopenharmony_ci}
861cb0ef41Sopenharmony_ci#table_of_contents ul:first-child {
871cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
881cb0ef41Sopenharmony_ci    border-radius: 6px;
891cb0ef41Sopenharmony_ci    padding: 1em;
901cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
911cb0ef41Sopenharmony_ci    color: #393a34;
921cb0ef41Sopenharmony_ci}
931cb0ef41Sopenharmony_ci#table_of_contents ul {
941cb0ef41Sopenharmony_ci    list-style-type: none;
951cb0ef41Sopenharmony_ci    padding-left: 1.5em;
961cb0ef41Sopenharmony_ci}
971cb0ef41Sopenharmony_ci#table_of_contents li {
981cb0ef41Sopenharmony_ci    font-size: 0.9em;
991cb0ef41Sopenharmony_ci}
1001cb0ef41Sopenharmony_ci#table_of_contents li a {
1011cb0ef41Sopenharmony_ci    color: #000000;
1021cb0ef41Sopenharmony_ci}
1031cb0ef41Sopenharmony_ci
1041cb0ef41Sopenharmony_ciheader.title {
1051cb0ef41Sopenharmony_ci    border-bottom: solid 1px #e1e4e8;
1061cb0ef41Sopenharmony_ci}
1071cb0ef41Sopenharmony_ciheader.title > h1 {
1081cb0ef41Sopenharmony_ci    margin-bottom: 0.25em;
1091cb0ef41Sopenharmony_ci}
1101cb0ef41Sopenharmony_ciheader.title > .description {
1111cb0ef41Sopenharmony_ci    display: block;
1121cb0ef41Sopenharmony_ci    margin-bottom: 0.5em;
1131cb0ef41Sopenharmony_ci    line-height: 1;
1141cb0ef41Sopenharmony_ci}
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_cifooter#edit {
1171cb0ef41Sopenharmony_ci    border-top: solid 1px #e1e4e8;
1181cb0ef41Sopenharmony_ci    margin: 3em 0 4em 0;
1191cb0ef41Sopenharmony_ci    padding-top: 2em;
1201cb0ef41Sopenharmony_ci}
1211cb0ef41Sopenharmony_ci</style>
1221cb0ef41Sopenharmony_ci</head>
1231cb0ef41Sopenharmony_ci<body>
1241cb0ef41Sopenharmony_ci<div id="banner">
1251cb0ef41Sopenharmony_ci<div id="rainbar"></div>
1261cb0ef41Sopenharmony_ci<div id="logobar">
1271cb0ef41Sopenharmony_ci<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700">
1281cb0ef41Sopenharmony_ci<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon>
1291cb0ef41Sopenharmony_ci<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon>
1301cb0ef41Sopenharmony_ci</svg>
1311cb0ef41Sopenharmony_ci<div class="title">
1321cb0ef41Sopenharmony_cinpm command-line interface
1331cb0ef41Sopenharmony_ci</div>
1341cb0ef41Sopenharmony_ci</div>
1351cb0ef41Sopenharmony_ci</div>
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci<section id="content">
1381cb0ef41Sopenharmony_ci<header class="title">
1391cb0ef41Sopenharmony_ci<h1 id="npm-link">npm-link</h1>
1401cb0ef41Sopenharmony_ci<span class="description">Symlink a package folder</span>
1411cb0ef41Sopenharmony_ci</header>
1421cb0ef41Sopenharmony_ci
1431cb0ef41Sopenharmony_ci<section id="table_of_contents">
1441cb0ef41Sopenharmony_ci<h2 id="table-of-contents">Table of contents</h2>
1451cb0ef41Sopenharmony_ci<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#caveat">Caveat</a></li><li><a href="#workspace-usage">Workspace Usage</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#save"><code>save</code></a></li><li><a href="#save-exact"><code>save-exact</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#install-strategy"><code>install-strategy</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#include"><code>include</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li><li><a href="#install-links"><code>install-links</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
1461cb0ef41Sopenharmony_ci</section>
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci<div id="_content"><h3 id="synopsis">Synopsis</h3>
1491cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm link [&lt;package-spec&gt;]
1501cb0ef41Sopenharmony_ci
1511cb0ef41Sopenharmony_cialias: ln
1521cb0ef41Sopenharmony_ci</code></pre>
1531cb0ef41Sopenharmony_ci<h3 id="description">Description</h3>
1541cb0ef41Sopenharmony_ci<p>This is handy for installing your own stuff, so that you can work on it and
1551cb0ef41Sopenharmony_citest iteratively without having to continually rebuild.</p>
1561cb0ef41Sopenharmony_ci<p>Package linking is a two-step process.</p>
1571cb0ef41Sopenharmony_ci<p>First, <code>npm link</code> in a package folder with no arguments will create a
1581cb0ef41Sopenharmony_cisymlink in the global folder <code>{prefix}/lib/node_modules/&lt;package&gt;</code> that
1591cb0ef41Sopenharmony_cilinks to the package where the <code>npm link</code> command was executed. It will
1601cb0ef41Sopenharmony_cialso link any bins in the package to <code>{prefix}/bin/{name}</code>.  Note that
1611cb0ef41Sopenharmony_ci<code>npm link</code> uses the global prefix (see <code>npm prefix -g</code> for its value).</p>
1621cb0ef41Sopenharmony_ci<p>Next, in some other location, <code>npm link package-name</code> will create a
1631cb0ef41Sopenharmony_cisymbolic link from globally-installed <code>package-name</code> to <code>node_modules/</code> of
1641cb0ef41Sopenharmony_cithe current folder.</p>
1651cb0ef41Sopenharmony_ci<p>Note that <code>package-name</code> is taken from <code>package.json</code>, <em>not</em> from the
1661cb0ef41Sopenharmony_cidirectory name.</p>
1671cb0ef41Sopenharmony_ci<p>The package name can be optionally prefixed with a scope. See
1681cb0ef41Sopenharmony_ci<a href="../using-npm/scope.html"><code>scope</code></a>.  The scope must be preceded by an @-symbol and
1691cb0ef41Sopenharmony_cifollowed by a slash.</p>
1701cb0ef41Sopenharmony_ci<p>When creating tarballs for <code>npm publish</code>, the linked packages are
1711cb0ef41Sopenharmony_ci"snapshotted" to their current state by resolving the symbolic links, if
1721cb0ef41Sopenharmony_cithey are included in <code>bundleDependencies</code>.</p>
1731cb0ef41Sopenharmony_ci<p>For example:</p>
1741cb0ef41Sopenharmony_ci<pre><code class="language-bash">cd ~/projects/node-redis    # go into the package directory
1751cb0ef41Sopenharmony_cinpm link                    # creates global link
1761cb0ef41Sopenharmony_cicd ~/projects/node-bloggy   # go into some other package directory.
1771cb0ef41Sopenharmony_cinpm link redis              # link-install the package
1781cb0ef41Sopenharmony_ci</code></pre>
1791cb0ef41Sopenharmony_ci<p>Now, any changes to <code>~/projects/node-redis</code> will be reflected in
1801cb0ef41Sopenharmony_ci<code>~/projects/node-bloggy/node_modules/node-redis/</code>. Note that the link
1811cb0ef41Sopenharmony_cishould be to the package name, not the directory name for that package.</p>
1821cb0ef41Sopenharmony_ci<p>You may also shortcut the two steps in one.  For example, to do the
1831cb0ef41Sopenharmony_ciabove use-case in a shorter way:</p>
1841cb0ef41Sopenharmony_ci<pre><code class="language-bash">cd ~/projects/node-bloggy  # go into the dir of your main project
1851cb0ef41Sopenharmony_cinpm link ../node-redis     # link the dir of your dependency
1861cb0ef41Sopenharmony_ci</code></pre>
1871cb0ef41Sopenharmony_ci<p>The second line is the equivalent of doing:</p>
1881cb0ef41Sopenharmony_ci<pre><code class="language-bash">(cd ../node-redis; npm link)
1891cb0ef41Sopenharmony_cinpm link redis
1901cb0ef41Sopenharmony_ci</code></pre>
1911cb0ef41Sopenharmony_ci<p>That is, it first creates a global link, and then links the global
1921cb0ef41Sopenharmony_ciinstallation target into your project's <code>node_modules</code> folder.</p>
1931cb0ef41Sopenharmony_ci<p>Note that in this case, you are referring to the directory name,
1941cb0ef41Sopenharmony_ci<code>node-redis</code>, rather than the package name <code>redis</code>.</p>
1951cb0ef41Sopenharmony_ci<p>If your linked package is scoped (see <a href="../using-npm/scope.html"><code>scope</code></a>) your
1961cb0ef41Sopenharmony_cilink command must include that scope, e.g.</p>
1971cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm link @myorg/privatepackage
1981cb0ef41Sopenharmony_ci</code></pre>
1991cb0ef41Sopenharmony_ci<h3 id="caveat">Caveat</h3>
2001cb0ef41Sopenharmony_ci<p>Note that package dependencies linked in this way are <em>not</em> saved to
2011cb0ef41Sopenharmony_ci<code>package.json</code> by default, on the assumption that the intention is to have
2021cb0ef41Sopenharmony_cia link stand in for a regular non-link dependency.  Otherwise, for example,
2031cb0ef41Sopenharmony_ciif you depend on <code>redis@^3.0.1</code>, and ran <code>npm link redis</code>, it would replace
2041cb0ef41Sopenharmony_cithe <code>^3.0.1</code> dependency with <code>file:../path/to/node-redis</code>, which you
2051cb0ef41Sopenharmony_ciprobably don't want!  Additionally, other users or developers on your
2061cb0ef41Sopenharmony_ciproject would run into issues if they do not have their folders set up
2071cb0ef41Sopenharmony_ciexactly the same as yours.</p>
2081cb0ef41Sopenharmony_ci<p>If you are adding a <em>new</em> dependency as a link, you should add it to the
2091cb0ef41Sopenharmony_cirelevant metadata by running <code>npm install &lt;dep&gt; --package-lock-only</code>.</p>
2101cb0ef41Sopenharmony_ci<p>If you <em>want</em> to save the <code>file:</code> reference in your <code>package.json</code> and
2111cb0ef41Sopenharmony_ci<code>package-lock.json</code> files, you can use <code>npm link &lt;dep&gt; --save</code> to do so.</p>
2121cb0ef41Sopenharmony_ci<h3 id="workspace-usage">Workspace Usage</h3>
2131cb0ef41Sopenharmony_ci<p><code>npm link &lt;pkg&gt; --workspace &lt;name&gt;</code> will link the relevant package as a
2141cb0ef41Sopenharmony_cidependency of the specified workspace(s).  Note that It may actually be
2151cb0ef41Sopenharmony_cilinked into the parent project's <code>node_modules</code> folder, if there are no
2161cb0ef41Sopenharmony_ciconflicting dependencies.</p>
2171cb0ef41Sopenharmony_ci<p><code>npm link --workspace &lt;name&gt;</code> will create a global link to the specified
2181cb0ef41Sopenharmony_ciworkspace(s).</p>
2191cb0ef41Sopenharmony_ci<h3 id="configuration">Configuration</h3>
2201cb0ef41Sopenharmony_ci<h4 id="save"><code>save</code></h4>
2211cb0ef41Sopenharmony_ci<ul>
2221cb0ef41Sopenharmony_ci<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
2231cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2241cb0ef41Sopenharmony_ci</ul>
2251cb0ef41Sopenharmony_ci<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
2261cb0ef41Sopenharmony_ci<p>When used with the <code>npm rm</code> command, removes the dependency from
2271cb0ef41Sopenharmony_ci<code>package.json</code>.</p>
2281cb0ef41Sopenharmony_ci<p>Will also prevent writing to <code>package-lock.json</code> if set to <code>false</code>.</p>
2291cb0ef41Sopenharmony_ci<h4 id="save-exact"><code>save-exact</code></h4>
2301cb0ef41Sopenharmony_ci<ul>
2311cb0ef41Sopenharmony_ci<li>Default: false</li>
2321cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2331cb0ef41Sopenharmony_ci</ul>
2341cb0ef41Sopenharmony_ci<p>Dependencies saved to package.json will be configured with an exact version
2351cb0ef41Sopenharmony_cirather than using npm's default semver range operator.</p>
2361cb0ef41Sopenharmony_ci<h4 id="global"><code>global</code></h4>
2371cb0ef41Sopenharmony_ci<ul>
2381cb0ef41Sopenharmony_ci<li>Default: false</li>
2391cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2401cb0ef41Sopenharmony_ci</ul>
2411cb0ef41Sopenharmony_ci<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
2421cb0ef41Sopenharmony_cifolder instead of the current working directory. See
2431cb0ef41Sopenharmony_ci<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
2441cb0ef41Sopenharmony_ci<ul>
2451cb0ef41Sopenharmony_ci<li>packages are installed into the <code>{prefix}/lib/node_modules</code> folder, instead
2461cb0ef41Sopenharmony_ciof the current working directory.</li>
2471cb0ef41Sopenharmony_ci<li>bin files are linked to <code>{prefix}/bin</code></li>
2481cb0ef41Sopenharmony_ci<li>man pages are linked to <code>{prefix}/share/man</code></li>
2491cb0ef41Sopenharmony_ci</ul>
2501cb0ef41Sopenharmony_ci<h4 id="install-strategy"><code>install-strategy</code></h4>
2511cb0ef41Sopenharmony_ci<ul>
2521cb0ef41Sopenharmony_ci<li>Default: "hoisted"</li>
2531cb0ef41Sopenharmony_ci<li>Type: "hoisted", "nested", "shallow", or "linked"</li>
2541cb0ef41Sopenharmony_ci</ul>
2551cb0ef41Sopenharmony_ci<p>Sets the strategy for installing packages in node_modules. hoisted
2561cb0ef41Sopenharmony_ci(default): Install non-duplicated in top-level, and duplicated as necessary
2571cb0ef41Sopenharmony_ciwithin directory structure. nested: (formerly --legacy-bundling) install in
2581cb0ef41Sopenharmony_ciplace, no hoisting. shallow (formerly --global-style) only install direct
2591cb0ef41Sopenharmony_cideps at top-level. linked: (experimental) install in node_modules/.store,
2601cb0ef41Sopenharmony_cilink in place, unhoisted.</p>
2611cb0ef41Sopenharmony_ci<h4 id="legacy-bundling"><code>legacy-bundling</code></h4>
2621cb0ef41Sopenharmony_ci<ul>
2631cb0ef41Sopenharmony_ci<li>Default: false</li>
2641cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2651cb0ef41Sopenharmony_ci<li>DEPRECATED: This option has been deprecated in favor of
2661cb0ef41Sopenharmony_ci<code>--install-strategy=nested</code></li>
2671cb0ef41Sopenharmony_ci</ul>
2681cb0ef41Sopenharmony_ci<p>Instead of hoisting package installs in <code>node_modules</code>, install packages in
2691cb0ef41Sopenharmony_cithe same manner that they are depended on. This may cause very deep
2701cb0ef41Sopenharmony_cidirectory structures and duplicate package installs as there is no
2711cb0ef41Sopenharmony_cide-duplicating. Sets <code>--install-strategy=nested</code>.</p>
2721cb0ef41Sopenharmony_ci<h4 id="global-style"><code>global-style</code></h4>
2731cb0ef41Sopenharmony_ci<ul>
2741cb0ef41Sopenharmony_ci<li>Default: false</li>
2751cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2761cb0ef41Sopenharmony_ci<li>DEPRECATED: This option has been deprecated in favor of
2771cb0ef41Sopenharmony_ci<code>--install-strategy=shallow</code></li>
2781cb0ef41Sopenharmony_ci</ul>
2791cb0ef41Sopenharmony_ci<p>Only install direct dependencies in the top level <code>node_modules</code>, but hoist
2801cb0ef41Sopenharmony_cion deeper dependencies. Sets <code>--install-strategy=shallow</code>.</p>
2811cb0ef41Sopenharmony_ci<h4 id="strict-peer-deps"><code>strict-peer-deps</code></h4>
2821cb0ef41Sopenharmony_ci<ul>
2831cb0ef41Sopenharmony_ci<li>Default: false</li>
2841cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
2851cb0ef41Sopenharmony_ci</ul>
2861cb0ef41Sopenharmony_ci<p>If set to <code>true</code>, and <code>--legacy-peer-deps</code> is not set, then <em>any</em>
2871cb0ef41Sopenharmony_ciconflicting <code>peerDependencies</code> will be treated as an install failure, even
2881cb0ef41Sopenharmony_ciif npm could reasonably guess the appropriate resolution based on non-peer
2891cb0ef41Sopenharmony_cidependency relationships.</p>
2901cb0ef41Sopenharmony_ci<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
2911cb0ef41Sopenharmony_cibe resolved using the nearest non-peer dependency specification, even if
2921cb0ef41Sopenharmony_cidoing so will result in some packages receiving a peer dependency outside
2931cb0ef41Sopenharmony_cithe range set in their package's <code>peerDependencies</code> object.</p>
2941cb0ef41Sopenharmony_ci<p>When such an override is performed, a warning is printed, explaining the
2951cb0ef41Sopenharmony_ciconflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
2961cb0ef41Sopenharmony_cithis warning is treated as a failure.</p>
2971cb0ef41Sopenharmony_ci<h4 id="package-lock"><code>package-lock</code></h4>
2981cb0ef41Sopenharmony_ci<ul>
2991cb0ef41Sopenharmony_ci<li>Default: true</li>
3001cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3011cb0ef41Sopenharmony_ci</ul>
3021cb0ef41Sopenharmony_ci<p>If set to false, then ignore <code>package-lock.json</code> files when installing. This
3031cb0ef41Sopenharmony_ciwill also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p>
3041cb0ef41Sopenharmony_ci<h4 id="omit"><code>omit</code></h4>
3051cb0ef41Sopenharmony_ci<ul>
3061cb0ef41Sopenharmony_ci<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
3071cb0ef41Sopenharmony_ci'production', otherwise empty.</li>
3081cb0ef41Sopenharmony_ci<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
3091cb0ef41Sopenharmony_ci</ul>
3101cb0ef41Sopenharmony_ci<p>Dependency types to omit from the installation tree on disk.</p>
3111cb0ef41Sopenharmony_ci<p>Note that these dependencies <em>are</em> still resolved and added to the
3121cb0ef41Sopenharmony_ci<code>package-lock.json</code> or <code>npm-shrinkwrap.json</code> file. They are just not
3131cb0ef41Sopenharmony_ciphysically installed on disk.</p>
3141cb0ef41Sopenharmony_ci<p>If a package type appears in both the <code>--include</code> and <code>--omit</code> lists, then
3151cb0ef41Sopenharmony_ciit will be included.</p>
3161cb0ef41Sopenharmony_ci<p>If the resulting omit list includes <code>'dev'</code>, then the <code>NODE_ENV</code> environment
3171cb0ef41Sopenharmony_civariable will be set to <code>'production'</code> for all lifecycle scripts.</p>
3181cb0ef41Sopenharmony_ci<h4 id="include"><code>include</code></h4>
3191cb0ef41Sopenharmony_ci<ul>
3201cb0ef41Sopenharmony_ci<li>Default:</li>
3211cb0ef41Sopenharmony_ci<li>Type: "prod", "dev", "optional", or "peer" (can be set multiple times)</li>
3221cb0ef41Sopenharmony_ci</ul>
3231cb0ef41Sopenharmony_ci<p>Option that allows for defining which types of dependencies to install.</p>
3241cb0ef41Sopenharmony_ci<p>This is the inverse of <code>--omit=&lt;type&gt;</code>.</p>
3251cb0ef41Sopenharmony_ci<p>Dependency types specified in <code>--include</code> will not be omitted, regardless of
3261cb0ef41Sopenharmony_cithe order in which omit/include are specified on the command-line.</p>
3271cb0ef41Sopenharmony_ci<h4 id="ignore-scripts"><code>ignore-scripts</code></h4>
3281cb0ef41Sopenharmony_ci<ul>
3291cb0ef41Sopenharmony_ci<li>Default: false</li>
3301cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3311cb0ef41Sopenharmony_ci</ul>
3321cb0ef41Sopenharmony_ci<p>If true, npm does not run scripts specified in package.json files.</p>
3331cb0ef41Sopenharmony_ci<p>Note that commands explicitly intended to run a particular script, such as
3341cb0ef41Sopenharmony_ci<code>npm start</code>, <code>npm stop</code>, <code>npm restart</code>, <code>npm test</code>, and <code>npm run-script</code>
3351cb0ef41Sopenharmony_ciwill still run their intended script if <code>ignore-scripts</code> is set, but they
3361cb0ef41Sopenharmony_ciwill <em>not</em> run any pre- or post-scripts.</p>
3371cb0ef41Sopenharmony_ci<h4 id="audit"><code>audit</code></h4>
3381cb0ef41Sopenharmony_ci<ul>
3391cb0ef41Sopenharmony_ci<li>Default: true</li>
3401cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3411cb0ef41Sopenharmony_ci</ul>
3421cb0ef41Sopenharmony_ci<p>When "true" submit audit reports alongside the current npm command to the
3431cb0ef41Sopenharmony_cidefault registry and all registries configured for scopes. See the
3441cb0ef41Sopenharmony_cidocumentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
3451cb0ef41Sopenharmony_cisubmitted.</p>
3461cb0ef41Sopenharmony_ci<h4 id="bin-links"><code>bin-links</code></h4>
3471cb0ef41Sopenharmony_ci<ul>
3481cb0ef41Sopenharmony_ci<li>Default: true</li>
3491cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3501cb0ef41Sopenharmony_ci</ul>
3511cb0ef41Sopenharmony_ci<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
3521cb0ef41Sopenharmony_ciexecutables.</p>
3531cb0ef41Sopenharmony_ci<p>Set to false to have it not do this. This can be used to work around the
3541cb0ef41Sopenharmony_cifact that some file systems don't support symlinks, even on ostensibly Unix
3551cb0ef41Sopenharmony_cisystems.</p>
3561cb0ef41Sopenharmony_ci<h4 id="fund"><code>fund</code></h4>
3571cb0ef41Sopenharmony_ci<ul>
3581cb0ef41Sopenharmony_ci<li>Default: true</li>
3591cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3601cb0ef41Sopenharmony_ci</ul>
3611cb0ef41Sopenharmony_ci<p>When "true" displays the message at the end of each <code>npm install</code>
3621cb0ef41Sopenharmony_ciacknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
3631cb0ef41Sopenharmony_ci<h4 id="dry-run"><code>dry-run</code></h4>
3641cb0ef41Sopenharmony_ci<ul>
3651cb0ef41Sopenharmony_ci<li>Default: false</li>
3661cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
3671cb0ef41Sopenharmony_ci</ul>
3681cb0ef41Sopenharmony_ci<p>Indicates that you don't want npm to make any changes and that it should
3691cb0ef41Sopenharmony_cionly report what it would have done. This can be passed into any of the
3701cb0ef41Sopenharmony_cicommands that modify your local installation, eg, <code>install</code>, <code>update</code>,
3711cb0ef41Sopenharmony_ci<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
3721cb0ef41Sopenharmony_ci<p>Note: This is NOT honored by other network related commands, eg <code>dist-tags</code>,
3731cb0ef41Sopenharmony_ci<code>owner</code>, etc.</p>
3741cb0ef41Sopenharmony_ci<h4 id="workspace"><code>workspace</code></h4>
3751cb0ef41Sopenharmony_ci<ul>
3761cb0ef41Sopenharmony_ci<li>Default:</li>
3771cb0ef41Sopenharmony_ci<li>Type: String (can be set multiple times)</li>
3781cb0ef41Sopenharmony_ci</ul>
3791cb0ef41Sopenharmony_ci<p>Enable running a command in the context of the configured workspaces of the
3801cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by
3811cb0ef41Sopenharmony_cithis configuration option.</p>
3821cb0ef41Sopenharmony_ci<p>Valid values for the <code>workspace</code> config are either:</p>
3831cb0ef41Sopenharmony_ci<ul>
3841cb0ef41Sopenharmony_ci<li>Workspace names</li>
3851cb0ef41Sopenharmony_ci<li>Path to a workspace directory</li>
3861cb0ef41Sopenharmony_ci<li>Path to a parent workspace directory (will result in selecting all
3871cb0ef41Sopenharmony_ciworkspaces within that folder)</li>
3881cb0ef41Sopenharmony_ci</ul>
3891cb0ef41Sopenharmony_ci<p>When set for the <code>npm init</code> command, this may be set to the folder of a
3901cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a
3911cb0ef41Sopenharmony_cibrand new workspace within the project.</p>
3921cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p>
3931cb0ef41Sopenharmony_ci<h4 id="workspaces"><code>workspaces</code></h4>
3941cb0ef41Sopenharmony_ci<ul>
3951cb0ef41Sopenharmony_ci<li>Default: null</li>
3961cb0ef41Sopenharmony_ci<li>Type: null or Boolean</li>
3971cb0ef41Sopenharmony_ci</ul>
3981cb0ef41Sopenharmony_ci<p>Set to true to run the command in the context of <strong>all</strong> configured
3991cb0ef41Sopenharmony_ciworkspaces.</p>
4001cb0ef41Sopenharmony_ci<p>Explicitly setting this to false will cause commands like <code>install</code> to
4011cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:</p>
4021cb0ef41Sopenharmony_ci<ul>
4031cb0ef41Sopenharmony_ci<li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.)
4041cb0ef41Sopenharmony_ciwill link workspaces into the <code>node_modules</code> folder. - Commands that do
4051cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project,
4061cb0ef41Sopenharmony_ci<em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li>
4071cb0ef41Sopenharmony_ci</ul>
4081cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p>
4091cb0ef41Sopenharmony_ci<h4 id="include-workspace-root"><code>include-workspace-root</code></h4>
4101cb0ef41Sopenharmony_ci<ul>
4111cb0ef41Sopenharmony_ci<li>Default: false</li>
4121cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
4131cb0ef41Sopenharmony_ci</ul>
4141cb0ef41Sopenharmony_ci<p>Include the workspace root when workspaces are enabled for a command.</p>
4151cb0ef41Sopenharmony_ci<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
4161cb0ef41Sopenharmony_ciall workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
4171cb0ef41Sopenharmony_cithe specified workspaces, and not on the root project.</p>
4181cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p>
4191cb0ef41Sopenharmony_ci<h4 id="install-links"><code>install-links</code></h4>
4201cb0ef41Sopenharmony_ci<ul>
4211cb0ef41Sopenharmony_ci<li>Default: false</li>
4221cb0ef41Sopenharmony_ci<li>Type: Boolean</li>
4231cb0ef41Sopenharmony_ci</ul>
4241cb0ef41Sopenharmony_ci<p>When set file: protocol dependencies will be packed and installed as regular
4251cb0ef41Sopenharmony_cidependencies instead of creating a symlink. This option has no effect on
4261cb0ef41Sopenharmony_ciworkspaces.</p>
4271cb0ef41Sopenharmony_ci<h3 id="see-also">See Also</h3>
4281cb0ef41Sopenharmony_ci<ul>
4291cb0ef41Sopenharmony_ci<li><a href="../using-npm/package-spec.html">package spec</a></li>
4301cb0ef41Sopenharmony_ci<li><a href="../using-npm/developers.html">npm developers</a></li>
4311cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/package-json.html">package.json</a></li>
4321cb0ef41Sopenharmony_ci<li><a href="../commands/npm-install.html">npm install</a></li>
4331cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/folders.html">npm folders</a></li>
4341cb0ef41Sopenharmony_ci<li><a href="../commands/npm-config.html">npm config</a></li>
4351cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
4361cb0ef41Sopenharmony_ci</ul></div>
4371cb0ef41Sopenharmony_ci
4381cb0ef41Sopenharmony_ci<footer id="edit">
4391cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm-link.md">
4401cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;">
4411cb0ef41Sopenharmony_ci<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path>
4421cb0ef41Sopenharmony_ci</svg>
4431cb0ef41Sopenharmony_ciEdit this page on GitHub
4441cb0ef41Sopenharmony_ci</a>
4451cb0ef41Sopenharmony_ci</footer>
4461cb0ef41Sopenharmony_ci</section>
4471cb0ef41Sopenharmony_ci
4481cb0ef41Sopenharmony_ci
4491cb0ef41Sopenharmony_ci
4501cb0ef41Sopenharmony_ci</body></html>