<h1 dir="auto">What / Why</h1>
<p dir="auto"><code class="notranslate">npm i</code> can fail when using local deps in a certain way.</p>
<h2 dir="auto">When</h2>
<p dir="auto">Running <code class="notranslate">npm i</code></p>
<h2 dir="auto">Where</h2>
<p dir="auto">In a package that includes local dependencies that depend on a common registry-derived module.</p>
<h2 dir="auto">How</h2>
<p dir="auto">In the situation where local (<code class="notranslate">file:</code>) deps form a chain and two share a common registry-derived dep, <code class="notranslate">npm i</code> will fail with an <code class="notranslate">ENOENT</code> error.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="A
|
B -&gt; some-module
|
C -&gt; some-module"><pre class="notranslate"><code class="notranslate">A
|
B -&gt; some-module
|
C -&gt; some-module
</code></pre></div>
<p dir="auto"><g-emoji class="g-emoji" alias="point_up" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/261d.png">☝️</g-emoji> <code class="notranslate">A</code> depends on <code class="notranslate">B</code>. <code class="notranslate">B</code> depends on <code class="notranslate">C</code> and <code class="notranslate">some-module</code>. <code class="notranslate">C</code> depends on <code class="notranslate">some-module</code>.</p>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Running <code class="notranslate">npm i</code> will throw an error like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm WARN rollback Rolling back some-module@x.y.z failed (this is probably harmless): /npm-nested-deps-issue/c/node_modules/some-module is not a child of /npm-nested-deps-issue/a
npm WARN a@1.0.0 No description
npm WARN a@1.0.0 No repository field.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /npm-nested-deps-issue/a/node_modules/.staging/some-module-de6f41e0
npm ERR! dest /npm-nested-deps-issue/c/node_modules/some-module
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/npm-nested-deps-issue/a/node_modules/.staging/some-module-de6f41e0' -&gt; '/npm-nested-deps-issue/c/node_modules/some-module'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent"><pre class="notranslate"><code class="notranslate">npm WARN rollback Rolling back some-module@x.y.z failed (this is probably harmless): /npm-nested-deps-issue/c/node_modules/some-module is not a child of /npm-nested-deps-issue/a
npm WARN a@1.0.0 No description
npm WARN a@1.0.0 No repository field.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /npm-nested-deps-issue/a/node_modules/.staging/some-module-de6f41e0
npm ERR! dest /npm-nested-deps-issue/c/node_modules/some-module
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/npm-nested-deps-issue/a/node_modules/.staging/some-module-de6f41e0' -&gt; '/npm-nested-deps-issue/c/node_modules/some-module'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
</code></pre></div>
<h3 dir="auto">Steps to Reproduce</h3>
<ol dir="auto">
<li>Clone <a href="https://github.com/treydavis/npm-nested-deps-issue">https://github.com/treydavis/npm-nested-deps-issue</a></li>
<li>run <code class="notranslate">npm i</code> in the <code class="notranslate">a</code> module</li>
</ol>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Install with no errors</p>
<p dir="auto">C:\Users\ramee\iSplendidtask\iSplendidApp&gt;npm install --save react-navigation<br>
npm ERR! cb() never called!</p>
<p dir="auto">npm ERR! This is an error with npm itself. Please report this error at:<br>
npm ERR!     <a href="https://npm.community" rel="nofollow">https://npm.community</a></p>
<p dir="auto">npm ERR! A complete log of this run can be found in:<br>
npm ERR!     C:\Users\ramee\AppData\Roaming\npm-cache_logs\2019-12-19T14_14_22_526Z-debug.log</p>