<p dir="auto">Note that this same issue was reported back in 2017 on the now-archived repo: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="208071714" data-permission-text="Title is private" data-url="https://github.com/npm/npm/issues/15783" data-hovercard-type="issue" data-hovercard-url="/npm/npm/issues/15783/hovercard" href="https://github.com/npm/npm/issues/15783">npm/npm#15783</a></p>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">I am using <code class="notranslate">npm link</code> to try to test changes I am making to an upstream dependency within my own project. In the dependency directory I run <code class="notranslate">npm link</code>. Then in my own project I run <code class="notranslate">npm link ffmpeg-stream</code>.</p>
<p dir="auto">NPM gives the following error message when running the second link command:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm ERR! code 1
npm ERR! path D:\git\node-ffmpeg-stream
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c &quot;tsc&quot;
npm ERR! Version 3.9.7
npm ERR! Syntax:   tsc [options] [file...]"><pre class="notranslate"><code class="notranslate">npm ERR! code 1
npm ERR! path D:\git\node-ffmpeg-stream
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "tsc"
npm ERR! Version 3.9.7
npm ERR! Syntax:   tsc [options] [file...]
</code></pre></div>
<p dir="auto">Afterwards, the directory of the upstream dependency is empty. Even the <code class="notranslate">.git</code> directory is deleted, so tough luck if you haven't pushed recently.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">NPM link should link the package without issue. If an error is encountered, NPM should not delete the entire folder contents.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>
<p dir="auto">Clone <code class="notranslate">https://github.com/JoshuaWalsh/node-ffmpeg-stream/</code></p>
</li>
<li>
<p dir="auto">Clone <code class="notranslate">https://github.com/JoshuaWalsh/subtitle-indexer</code></p>
</li>
<li>
<p dir="auto">In <code class="notranslate">node-ffmpeg-stream</code>, run <code class="notranslate">npm ci --include=prod</code></p>
</li>
<li>
<p dir="auto">In <code class="notranslate">node-ffmpeg-stream</code>, run <code class="notranslate">npm link</code></p>
</li>
<li>
<p dir="auto">In <code class="notranslate">subtitle-indexer</code>, run <code class="notranslate">npm link ffmpeg-stream</code></p>
</li>
<li>
<p dir="auto">Observe that the <code class="notranslate">node-ffmpeg-stream</code> directory is now empty. (A small number of files may remain if they were in use at the time and couldn't be deleted)</p>
</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Windows 10 Pro 10.0.19042</li>
<li>Node: 15.0.1</li>
<li>npm: 7.0.3</li>
</ul>
<p dir="auto">I am using <code class="notranslate">nvm-windows</code> to manage NodeJS, but currently only have one version installed.</p>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">cb() never called!</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">Download and install file successfully using npm</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>write npm i discord.js (example)</li>
<li>Error cb() never called!</li>
</ol>
<h3 dir="auto">Environment:</h3>
<p dir="auto">npm: 6.14.6</p>