<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">I was about to update my global package I has in my machine. Turns out, when I did it DELETED all my global packages.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/12274383/137017120-997d5271-1387-4f66-a7bd-84538c33f71f.png"><img src="https://user-images.githubusercontent.com/12274383/137017120-997d5271-1387-4f66-a7bd-84538c33f71f.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">After it, I had to reinstall the npm.</p>
<p dir="auto">Also looking at /usr/local/bin the npm wasn't there anymore.</p>
<p dir="auto">I can't remember the exactly version I had , it was deleted, but my node version is 14.17.0 and I was using the npm version that comes with it.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">To update the global package</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>npm update -g detox</li>
<li>See the attached image</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: MAC OS</li>
<li>Node: 14.17.0</li>
<li>npm: ????</li>
</ul>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">Attempting to update a package with a tag using the <code class="notranslate">update</code> command globally causes <strong>ALL</strong> global packages to be removed.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">Packages should not be removed when updating global packages.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="npm i -g typescript nodemon @angular/cli # Install some global packages
npm ls -g --depth=0 # This shows the 3 installed packages
npm update -g @angular/cli@latest # Attempt to update one of the packages with a @latest tag
# Oh no! removed 620 packages
npm ls -g --depth=0 # Shows `-- (empty)"><pre class="notranslate">npm i -g typescript nodemon @angular/cli <span class="pl-c"><span class="pl-c">#</span> Install some global packages</span>
npm ls -g --depth=0 <span class="pl-c"><span class="pl-c">#</span> This shows the 3 installed packages</span>
npm update -g @angular/cli@latest <span class="pl-c"><span class="pl-c">#</span> Attempt to update one of the packages with a @latest tag</span>
<span class="pl-c"><span class="pl-c">#</span> Oh no! removed 620 packages</span>
npm ls -g --depth=0 <span class="pl-c"><span class="pl-c">#</span> Shows `-- (empty)</span></pre></div>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Windows 10 20H2</li>
<li>Node: 15.9.0</li>
<li>npm: 7.11.2</li>
</ul>
<h3 dir="auto">Additional Info</h3>
<p dir="auto">This only happens on the global scope</p>