<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">This issue exists in the latest npm version</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I am using the latest npm</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Currently, my package.json specifies <code class="notranslate">"typescript": "^5.0.2"</code>. When I change it to say <code class="notranslate">"typescript": "^5.0.3"</code>, npm 9 spins for 4:28 before deciding it doesn't exist. For comparison, npm 8 installs it with no problem in 0:44.</p>
<p dir="auto">Ironically, I can't upgrade npm to 9.6 due to this issue: npm 9.5.1 times out when I run <code class="notranslate">npm i -g npm</code>.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">npm 9 should be able to locate and download these versions with similar performance to npm 8.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Have a project with a v2 lockfile and TypeScript 5.0.2</li>
<li>Install node 18.16.0 with npm 9.5.1</li>
<li>Update the package.json to request TypeScript 5.0.3 or newer</li>
<li>Run <code class="notranslate">npm i</code></li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 9.5.1</li>
<li>Node.js: 18.16.0</li>
<li>OS Name: Windows 10</li>
<li>System Model Name: Maingear Vector 2</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; &quot;user&quot; config from C:\Users\bbrk2\.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = C:\Users\bbrk2\.nvm\versions\node\v18.16.0\bin\node.exe
; node version = v18.16.0
; npm local prefix = C:\Users\bbrk2\[REDACTED]
; npm version = 9.5.1
; cwd = C:\Users\bbrk2\[REDACTED]
; HOME = C:\Users\bbrk2
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "user" config from C:\Users\bbrk2\.npmrc</span>

//registry.npmjs.org/:<span class="pl-k">_authToken</span> = (protected) 

<span class="pl-c"><span class="pl-c">;</span> node bin location = C:\Users\bbrk2\.nvm\versions\node\v18.16.0\bin\node.exe</span>
<span class="pl-c"><span class="pl-c">;</span> node version = v18.16.0</span>
<span class="pl-c"><span class="pl-c">;</span> npm local prefix = C:\Users\bbrk2\[REDACTED]</span>
<span class="pl-c"><span class="pl-c">;</span> npm version = 9.5.1</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = C:\Users\bbrk2\[REDACTED]</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = C:\Users\bbrk2</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>
<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">This issue exists in the latest npm version</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I am using the latest npm</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">When running <code class="notranslate">npm install</code> it will sometimes hang at a random point.  When it does this, it is stuck forever.  CTRL+C will do nothing the first time that combination is pressed when this has occurred.  Pressing that key combination the second time will make the current line (the one showing the little progress bar) disappear but that's it.  No further responses to that key combination are observed.</p>
<p dir="auto">The CMD (or Powershell) window cannot be closed regardless.  The process cannot be killed by Task Manager either (Access Denied, although I'm an Administrator user so I'd assume the real reason is something non-permissions related).  The only way I have found to close it is to reboot the machine.</p>
<p dir="auto">My suspicion is it's some sort of deadlock, but this is a guess and I have no idea how to further investigate this.  I've tried using Process Explorer to check for handles to files in the project directory from other processes but there are none.  There are handles held by the Node process npm is using, and one for the CMD window hosting it, but that's it.</p>
<p dir="auto">Even running with <code class="notranslate">log-level silly</code> yields no useful information.  When it freezes there are no warnings or errors, it just sits on the line it was on.  This is some log output from one of the times when it got stuck (I should again emphasise that the point where it gets stuck seems to be random, so the last line shown here isn't always the one it freezes on):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm timing auditReport:init Completed in 49242ms
npm timing reify:audit Completed in 55729ms
npm timing reifyNode:node_modules/selenium-webdriver Completed in 54728ms
npm timing reifyNode:node_modules/regenerate-unicode-properties Completed in 55637ms
npm timing reifyNode:node_modules/ajv-formats/node_modules/ajv Completed in 56497ms
npm timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 56472ms
[##################] \ reify:ajv: timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 564"><pre class="notranslate"><code class="notranslate">npm timing auditReport:init Completed in 49242ms
npm timing reify:audit Completed in 55729ms
npm timing reifyNode:node_modules/selenium-webdriver Completed in 54728ms
npm timing reifyNode:node_modules/regenerate-unicode-properties Completed in 55637ms
npm timing reifyNode:node_modules/ajv-formats/node_modules/ajv Completed in 56497ms
npm timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 56472ms
[##################] \ reify:ajv: timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 564
</code></pre></div>
<p dir="auto">The only thing that I can think of right now is that Bit Defender (the only other application running) is interfering somehow, however it's the one application I can't turn off.</p>
<p dir="auto">I've seen this issue occur on different projects, on different network and internet connections, and on different machines.  Does anyone have any advice on how to investigate this, or at the very least a way to kill the process when it hangs like this without having to reboot the machine?  Being forced to reboot when this issue occurs is perhaps the most frustrating thing in all of this.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">npm install</code> should either succeed or show an error.  If it gets stuck it should either time-out or be closable by the user.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Clear down the <code class="notranslate">node_modules</code> folder (ie with something like <code class="notranslate">rmdir /q /s</code>)</li>
<li>Run. <code class="notranslate">npm install</code></li>
<li>Watch and wait.</li>
<li>If it succeeds, repeat the above steps until the freeze is observed.</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.1.3</li>
<li>Node: v16.13.0</li>
<li>OS: Windows 10 Version 21H1 (OS Build 19043.1288)</li>
<li>platform: Lenovo ThinkPad</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; &quot;builtin&quot; config from C:\Users\&lt;REDACTED&gt;\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = &quot;C:\\Users\\&lt;REDACTED&gt;\\AppData\\Roaming\\npm&quot;

; &quot;user&quot; config from C:\Users\&lt;REDACTED&gt;\.npmrc

//pkgs.dev.azure.com/&lt;REDACTED&gt;/_packaging/&lt;REDACTED&gt;/npm/registry/:_authToken = (protected)

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\&lt;REDACTED&gt;
; HOME = C:\Users\&lt;REDACTED&gt;
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "builtin" config from C:\Users\&lt;REDACTED&gt;\AppData\Roaming\npm\node_modules\npm\npmrc</span>

<span class="pl-k">prefix</span> = <span class="pl-s"><span class="pl-pds">"</span>C:\\Users\\&lt;REDACTED&gt;\\AppData\\Roaming\\npm<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> "user" config from C:\Users\&lt;REDACTED&gt;\.npmrc</span>

//pkgs.dev.azure.com/&lt;REDACTED&gt;/_packaging/&lt;REDACTED&gt;/npm/registry/:<span class="pl-k">_authToken</span> = (protected)

<span class="pl-c"><span class="pl-c">;</span> node bin location = C:\Program Files\nodejs\node.exe</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = C:\Users\&lt;REDACTED&gt;</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = C:\Users\&lt;REDACTED&gt;</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>