11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head> 21cb0ef41Sopenharmony_ci<meta charset="utf-8"> 31cb0ef41Sopenharmony_ci<title>folders</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="folders">folders</h1> 1401cb0ef41Sopenharmony_ci<span class="description">Folder Structures Used by npm</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="#description">Description</a></li><ul><li><a href="#tldr">tl;dr</a></li><li><a href="#prefix-configuration">prefix Configuration</a></li><li><a href="#node-modules">Node Modules</a></li><li><a href="#executables">Executables</a></li><li><a href="#man-pages">Man Pages</a></li><li><a href="#cache">Cache</a></li><li><a href="#temp-files">Temp Files</a></li></ul><li><a href="#more-information">More Information</a></li><ul><li><a href="#global-installation">Global Installation</a></li><li><a href="#cycles-conflicts-and-folder-parsimony">Cycles, Conflicts, and Folder Parsimony</a></li><li><a href="#example">Example</a></li><li><a href="#publishing">Publishing</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="description">Description</h3> 1491cb0ef41Sopenharmony_ci<p>npm puts various things on your computer. That's its job.</p> 1501cb0ef41Sopenharmony_ci<p>This document will tell you what it puts where.</p> 1511cb0ef41Sopenharmony_ci<h4 id="tldr">tl;dr</h4> 1521cb0ef41Sopenharmony_ci<ul> 1531cb0ef41Sopenharmony_ci<li>Local install (default): puts stuff in <code>./node_modules</code> of the current 1541cb0ef41Sopenharmony_cipackage root.</li> 1551cb0ef41Sopenharmony_ci<li>Global install (with <code>-g</code>): puts stuff in /usr/local or wherever node 1561cb0ef41Sopenharmony_ciis installed.</li> 1571cb0ef41Sopenharmony_ci<li>Install it <strong>locally</strong> if you're going to <code>require()</code> it.</li> 1581cb0ef41Sopenharmony_ci<li>Install it <strong>globally</strong> if you're going to run it on the command line.</li> 1591cb0ef41Sopenharmony_ci<li>If you need both, then install it in both places, or use <code>npm link</code>.</li> 1601cb0ef41Sopenharmony_ci</ul> 1611cb0ef41Sopenharmony_ci<h4 id="prefix-configuration">prefix Configuration</h4> 1621cb0ef41Sopenharmony_ci<p>The <a href="../using-npm/config#prefix.html"><code>prefix</code> config</a> defaults to the location where 1631cb0ef41Sopenharmony_cinode is installed. On most systems, this is <code>/usr/local</code>. On Windows, it's 1641cb0ef41Sopenharmony_ci<code>%AppData%\npm</code>. On Unix systems, it's one level up, since node is typically 1651cb0ef41Sopenharmony_ciinstalled at <code>{prefix}/bin/node</code> rather than <code>{prefix}/node.exe</code>.</p> 1661cb0ef41Sopenharmony_ci<p>When the <code>global</code> flag is set, npm installs things into this prefix. 1671cb0ef41Sopenharmony_ciWhen it is not set, it uses the root of the current package, or the 1681cb0ef41Sopenharmony_cicurrent working directory if not in a package already.</p> 1691cb0ef41Sopenharmony_ci<h4 id="node-modules">Node Modules</h4> 1701cb0ef41Sopenharmony_ci<p>Packages are dropped into the <code>node_modules</code> folder under the <code>prefix</code>. 1711cb0ef41Sopenharmony_ciWhen installing locally, this means that you can 1721cb0ef41Sopenharmony_ci<code>require("packagename")</code> to load its main module, or 1731cb0ef41Sopenharmony_ci<code>require("packagename/lib/path/to/sub/module")</code> to load other modules.</p> 1741cb0ef41Sopenharmony_ci<p>Global installs on Unix systems go to <code>{prefix}/lib/node_modules</code>. 1751cb0ef41Sopenharmony_ciGlobal installs on Windows go to <code>{prefix}/node_modules</code> (that is, no 1761cb0ef41Sopenharmony_ci<code>lib</code> folder.)</p> 1771cb0ef41Sopenharmony_ci<p>Scoped packages are installed the same way, except they are grouped together 1781cb0ef41Sopenharmony_ciin a sub-folder of the relevant <code>node_modules</code> folder with the name of that 1791cb0ef41Sopenharmony_ciscope prefix by the @ symbol, e.g. <code>npm install @myorg/package</code> would place 1801cb0ef41Sopenharmony_cithe package in <code>{prefix}/node_modules/@myorg/package</code>. See 1811cb0ef41Sopenharmony_ci<a href="../using-npm/scope.html"><code>scope</code></a> for more details.</p> 1821cb0ef41Sopenharmony_ci<p>If you wish to <code>require()</code> a package, then install it locally.</p> 1831cb0ef41Sopenharmony_ci<h4 id="executables">Executables</h4> 1841cb0ef41Sopenharmony_ci<p>When in global mode, executables are linked into <code>{prefix}/bin</code> on Unix, 1851cb0ef41Sopenharmony_cior directly into <code>{prefix}</code> on Windows. Ensure that path is in your 1861cb0ef41Sopenharmony_citerminal's <code>PATH</code> environment to run them.</p> 1871cb0ef41Sopenharmony_ci<p>When in local mode, executables are linked into 1881cb0ef41Sopenharmony_ci<code>./node_modules/.bin</code> so that they can be made available to scripts run 1891cb0ef41Sopenharmony_cithrough npm. (For example, so that a test runner will be in the path 1901cb0ef41Sopenharmony_ciwhen you run <code>npm test</code>.)</p> 1911cb0ef41Sopenharmony_ci<h4 id="man-pages">Man Pages</h4> 1921cb0ef41Sopenharmony_ci<p>When in global mode, man pages are linked into <code>{prefix}/share/man</code>.</p> 1931cb0ef41Sopenharmony_ci<p>When in local mode, man pages are not installed.</p> 1941cb0ef41Sopenharmony_ci<p>Man pages are not installed on Windows systems.</p> 1951cb0ef41Sopenharmony_ci<h4 id="cache">Cache</h4> 1961cb0ef41Sopenharmony_ci<p>See <a href="../commands/npm-cache.html"><code>npm cache</code></a>. Cache files are stored in <code>~/.npm</code> on Posix, or 1971cb0ef41Sopenharmony_ci<code>%LocalAppData%/npm-cache</code> on Windows.</p> 1981cb0ef41Sopenharmony_ci<p>This is controlled by the <a href="../using-npm/config#cache.html"><code>cache</code> config</a> param.</p> 1991cb0ef41Sopenharmony_ci<h4 id="temp-files">Temp Files</h4> 2001cb0ef41Sopenharmony_ci<p>Temporary files are stored by default in the folder specified by the 2011cb0ef41Sopenharmony_ci<a href="../using-npm/config#tmp.html"><code>tmp</code> config</a>, which defaults to the TMPDIR, TMP, or 2021cb0ef41Sopenharmony_ciTEMP environment variables, or <code>/tmp</code> on Unix and <code>c:\windows\temp</code> on Windows.</p> 2031cb0ef41Sopenharmony_ci<p>Temp files are given a unique folder under this root for each run of the 2041cb0ef41Sopenharmony_ciprogram, and are deleted upon successful exit.</p> 2051cb0ef41Sopenharmony_ci<h3 id="more-information">More Information</h3> 2061cb0ef41Sopenharmony_ci<p>When installing locally, npm first tries to find an appropriate 2071cb0ef41Sopenharmony_ci<code>prefix</code> folder. This is so that <code>npm install foo@1.2.3</code> will install 2081cb0ef41Sopenharmony_cito the sensible root of your package, even if you happen to have <code>cd</code>ed 2091cb0ef41Sopenharmony_ciinto some other folder.</p> 2101cb0ef41Sopenharmony_ci<p>Starting at the $PWD, npm will walk up the folder tree checking for a 2111cb0ef41Sopenharmony_cifolder that contains either a <code>package.json</code> file, or a <code>node_modules</code> 2121cb0ef41Sopenharmony_cifolder. If such a thing is found, then that is treated as the effective 2131cb0ef41Sopenharmony_ci"current directory" for the purpose of running npm commands. (This 2141cb0ef41Sopenharmony_cibehavior is inspired by and similar to git's .git-folder seeking 2151cb0ef41Sopenharmony_cilogic when running git commands in a working dir.)</p> 2161cb0ef41Sopenharmony_ci<p>If no package root is found, then the current folder is used.</p> 2171cb0ef41Sopenharmony_ci<p>When you run <code>npm install foo@1.2.3</code>, then the package is loaded into 2181cb0ef41Sopenharmony_cithe cache, and then unpacked into <code>./node_modules/foo</code>. Then, any of 2191cb0ef41Sopenharmony_cifoo's dependencies are similarly unpacked into 2201cb0ef41Sopenharmony_ci<code>./node_modules/foo/node_modules/...</code>.</p> 2211cb0ef41Sopenharmony_ci<p>Any bin files are symlinked to <code>./node_modules/.bin/</code>, so that they may 2221cb0ef41Sopenharmony_cibe found by npm scripts when necessary.</p> 2231cb0ef41Sopenharmony_ci<h4 id="global-installation">Global Installation</h4> 2241cb0ef41Sopenharmony_ci<p>If the <a href="../using-npm/config#global.html"><code>global</code> config</a> is set to true, then npm will 2251cb0ef41Sopenharmony_ciinstall packages "globally".</p> 2261cb0ef41Sopenharmony_ci<p>For global installation, packages are installed roughly the same way, 2271cb0ef41Sopenharmony_cibut using the folders described above.</p> 2281cb0ef41Sopenharmony_ci<h4 id="cycles-conflicts-and-folder-parsimony">Cycles, Conflicts, and Folder Parsimony</h4> 2291cb0ef41Sopenharmony_ci<p>Cycles are handled using the property of node's module system that it 2301cb0ef41Sopenharmony_ciwalks up the directories looking for <code>node_modules</code> folders. So, at every 2311cb0ef41Sopenharmony_cistage, if a package is already installed in an ancestor <code>node_modules</code> 2321cb0ef41Sopenharmony_cifolder, then it is not installed at the current location.</p> 2331cb0ef41Sopenharmony_ci<p>Consider the case above, where <code>foo -> bar -> baz</code>. Imagine if, in 2341cb0ef41Sopenharmony_ciaddition to that, baz depended on bar, so you'd have: 2351cb0ef41Sopenharmony_ci<code>foo -> bar -> baz -> bar -> baz ...</code>. However, since the folder 2361cb0ef41Sopenharmony_cistructure is: <code>foo/node_modules/bar/node_modules/baz</code>, there's no need to 2371cb0ef41Sopenharmony_ciput another copy of bar into <code>.../baz/node_modules</code>, since when baz calls 2381cb0ef41Sopenharmony_ci<code>require("bar")</code>, it will get the copy that is installed in 2391cb0ef41Sopenharmony_ci<code>foo/node_modules/bar</code>.</p> 2401cb0ef41Sopenharmony_ci<p>This shortcut is only used if the exact same 2411cb0ef41Sopenharmony_civersion would be installed in multiple nested <code>node_modules</code> folders. It 2421cb0ef41Sopenharmony_ciis still possible to have <code>a/node_modules/b/node_modules/a</code> if the two 2431cb0ef41Sopenharmony_ci"a" packages are different versions. However, without repeating the 2441cb0ef41Sopenharmony_ciexact same package multiple times, an infinite regress will always be 2451cb0ef41Sopenharmony_ciprevented.</p> 2461cb0ef41Sopenharmony_ci<p>Another optimization can be made by installing dependencies at the 2471cb0ef41Sopenharmony_cihighest level possible, below the localized "target" folder (hoisting). 2481cb0ef41Sopenharmony_ciSince version 3, npm hoists dependencies by default.</p> 2491cb0ef41Sopenharmony_ci<h4 id="example">Example</h4> 2501cb0ef41Sopenharmony_ci<p>Consider this dependency graph:</p> 2511cb0ef41Sopenharmony_ci<pre><code class="language-bash">foo 2521cb0ef41Sopenharmony_ci+-- blerg@1.2.5 2531cb0ef41Sopenharmony_ci+-- bar@1.2.3 2541cb0ef41Sopenharmony_ci| +-- blerg@1.x (latest=1.3.7) 2551cb0ef41Sopenharmony_ci| +-- baz@2.x 2561cb0ef41Sopenharmony_ci| | `-- quux@3.x 2571cb0ef41Sopenharmony_ci| | `-- bar@1.2.3 (cycle) 2581cb0ef41Sopenharmony_ci| `-- asdf@* 2591cb0ef41Sopenharmony_ci`-- baz@1.2.3 2601cb0ef41Sopenharmony_ci `-- quux@3.x 2611cb0ef41Sopenharmony_ci `-- bar 2621cb0ef41Sopenharmony_ci</code></pre> 2631cb0ef41Sopenharmony_ci<p>In this case, we might expect a folder structure like this 2641cb0ef41Sopenharmony_ci(with all dependencies hoisted to the highest level possible):</p> 2651cb0ef41Sopenharmony_ci<pre><code class="language-bash">foo 2661cb0ef41Sopenharmony_ci+-- node_modules 2671cb0ef41Sopenharmony_ci +-- blerg (1.2.5) <---[A] 2681cb0ef41Sopenharmony_ci +-- bar (1.2.3) <---[B] 2691cb0ef41Sopenharmony_ci | +-- node_modules 2701cb0ef41Sopenharmony_ci | +-- baz (2.0.2) <---[C] 2711cb0ef41Sopenharmony_ci +-- asdf (2.3.4) 2721cb0ef41Sopenharmony_ci +-- baz (1.2.3) <---[D] 2731cb0ef41Sopenharmony_ci +-- quux (3.2.0) <---[E] 2741cb0ef41Sopenharmony_ci</code></pre> 2751cb0ef41Sopenharmony_ci<p>Since foo depends directly on <code>bar@1.2.3</code> and <code>baz@1.2.3</code>, those are 2761cb0ef41Sopenharmony_ciinstalled in foo's <code>node_modules</code> folder.</p> 2771cb0ef41Sopenharmony_ci<p>Even though the latest copy of blerg is 1.3.7, foo has a specific 2781cb0ef41Sopenharmony_cidependency on version 1.2.5. So, that gets installed at [A]. Since the 2791cb0ef41Sopenharmony_ciparent installation of blerg satisfies bar's dependency on <code>blerg@1.x</code>, 2801cb0ef41Sopenharmony_ciit does not install another copy under [B].</p> 2811cb0ef41Sopenharmony_ci<p>Bar [B] also has dependencies on baz and asdf. Because it depends on <code>baz@2.x</code>, it cannot 2821cb0ef41Sopenharmony_cire-use the <code>baz@1.2.3</code> installed in the parent <code>node_modules</code> folder [D], 2831cb0ef41Sopenharmony_ciand must install its own copy [C]. In order to minimize duplication, npm hoists 2841cb0ef41Sopenharmony_cidependencies to the top level by default, so asdf is installed under [A].</p> 2851cb0ef41Sopenharmony_ci<p>Underneath bar, the <code>baz -> quux -> bar</code> dependency creates a cycle. 2861cb0ef41Sopenharmony_ciHowever, because bar is already in quux's ancestry [B], it does not 2871cb0ef41Sopenharmony_ciunpack another copy of bar into that folder. Likewise, quux's [E] 2881cb0ef41Sopenharmony_cifolder tree is empty, because its dependency on bar is satisfied 2891cb0ef41Sopenharmony_ciby the parent folder copy installed at [B].</p> 2901cb0ef41Sopenharmony_ci<p>For a graphical breakdown of what is installed where, use <code>npm ls</code>.</p> 2911cb0ef41Sopenharmony_ci<h4 id="publishing">Publishing</h4> 2921cb0ef41Sopenharmony_ci<p>Upon publishing, npm will look in the <code>node_modules</code> folder. If any of 2931cb0ef41Sopenharmony_cithe items there are not in the <code>bundleDependencies</code> array, then they will 2941cb0ef41Sopenharmony_cinot be included in the package tarball.</p> 2951cb0ef41Sopenharmony_ci<p>This allows a package maintainer to install all of their dependencies 2961cb0ef41Sopenharmony_ci(and dev dependencies) locally, but only re-publish those items that 2971cb0ef41Sopenharmony_cicannot be found elsewhere. See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for more information.</p> 2981cb0ef41Sopenharmony_ci<h3 id="see-also">See also</h3> 2991cb0ef41Sopenharmony_ci<ul> 3001cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/package-json.html">package.json</a></li> 3011cb0ef41Sopenharmony_ci<li><a href="../commands/npm-install.html">npm install</a></li> 3021cb0ef41Sopenharmony_ci<li><a href="../commands/npm-pack.html">npm pack</a></li> 3031cb0ef41Sopenharmony_ci<li><a href="../commands/npm-cache.html">npm cache</a></li> 3041cb0ef41Sopenharmony_ci<li><a href="../commands/npm-config.html">npm config</a></li> 3051cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/npmrc.html">npmrc</a></li> 3061cb0ef41Sopenharmony_ci<li><a href="../using-npm/config.html">config</a></li> 3071cb0ef41Sopenharmony_ci<li><a href="../commands/npm-publish.html">npm publish</a></li> 3081cb0ef41Sopenharmony_ci</ul></div> 3091cb0ef41Sopenharmony_ci 3101cb0ef41Sopenharmony_ci<footer id="edit"> 3111cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/configuring-npm/folders.md"> 3121cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;"> 3131cb0ef41Sopenharmony_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> 3141cb0ef41Sopenharmony_ci</svg> 3151cb0ef41Sopenharmony_ciEdit this page on GitHub 3161cb0ef41Sopenharmony_ci</a> 3171cb0ef41Sopenharmony_ci</footer> 3181cb0ef41Sopenharmony_ci</section> 3191cb0ef41Sopenharmony_ci 3201cb0ef41Sopenharmony_ci 3211cb0ef41Sopenharmony_ci 3221cb0ef41Sopenharmony_ci</body></html>