<h1 dir="auto">The problem</h1>

<blockquote>
<p dir="auto">I have cloned <a href="https://github.com/microsoft/vscode-extension-samples.git">Microsoft's VSCode Language server</a>. I then change directory to the example I'm interested in (<code class="notranslate">lsp-samples</code>) and run <code class="notranslate">npm install</code> in that folder.</p>
</blockquote>
<p dir="auto">It quickly dies the the following error message:</p>
<p dir="auto">npm ERR! code EEXIST<br>
npm ERR! syscall mkdir<br>
npm ERR! path G:\My Drive\Git\vscode-extension-samples\vscode-extension-samples\lsp-sample\node_modules.staging<br>
npm ERR! errno -4075<br>
npm ERR! EEXIST: file already exists, mkdir 'G:\My Drive\Git\vscode-extension-samples\vscode-extension-samples\lsp-sample\node_modules.staging'<br>
npm ERR! File exists: G:\My Drive\Git\vscode-extension-samples\vscode-extension-samples\lsp-sample\node_modules.staging<br>
npm ERR! Remove the existing file and try again, or run npm<br>
npm ERR! with --force to overwrite files recklessly.</p>
<p dir="auto">See attached log file.<br>
<a href="https://github.com/npm/cli/files/4041728/2020-01-09T17_39_35_413Z-debug.log">2020-01-09T17_39_35_413Z-debug.log</a></p>
<h1 dir="auto">What's weird</h1>
<p dir="auto">is that it complains that the .staging directory already exists, when it is the install process itself that created the folder (when I start, there is no preexisting node_modules folder).</p>
<p dir="auto">Any idea what the problem might be ? I've tried reinstalling npm, deleting the node_modules folder and starting over, deleting the intermediate .staging folder, using the --force option, to no avail...</p>
<h1 dir="auto">What / Why</h1>

<p dir="auto"><code class="notranslate">npm</code> command is removed after running <code class="notranslate">npm install -g npm</code>.</p>
<h2 dir="auto">When</h2>

<ul dir="auto">
<li>2019/12/18</li>
<li>I can't remember exactly when I succeeded in running this command but at least a week ago.</li>
</ul>
<h2 dir="auto">Where</h2>

<ul dir="auto">
<li>npm/cli</li>
</ul>
<h2 dir="auto">How</h2>
<h3 dir="auto">Current Behavior</h3>

<p dir="auto">This is the log:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~
% brew install node
==&gt; Downloading https://homebrew.bintray.com/bottles/node-13.3.0_1.catalina.bottle.tar.gz
Already downloaded: /Users/manabu/Library/Caches/Homebrew/downloads/8a482358c0487b3ffeeebf4d1f3b3ca825018f6318ecdd6368fd0a6f45e0bea1--node-13.3.0_1.catalina.bottle.tar.gz
==&gt; Pouring node-13.3.0_1.catalina.bottle.tar.gz
==&gt; Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==&gt; Summary
🍺  /usr/local/Cellar/node/13.3.0_1: 4,663 files, 59MB

~
% npm install -g npm
/usr/local/bin/npx -&gt; /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -&gt; /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../../../lib/node_modules/npm/man/man1/npm-access.1
npm ERR! dest /usr/local/share/man/man1/npm-access.1
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npm-access.1' -&gt; '/usr/local/share/man/man1/npm-access.1'
npm ERR! File exists: /usr/local/share/man/man1/npm-access.1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/manabu/.npm/_logs/2019-12-18T07_51_00_280Z-debug.log"><pre class="notranslate"><code class="notranslate">~
% brew install node
==&gt; Downloading https://homebrew.bintray.com/bottles/node-13.3.0_1.catalina.bottle.tar.gz
Already downloaded: /Users/manabu/Library/Caches/Homebrew/downloads/8a482358c0487b3ffeeebf4d1f3b3ca825018f6318ecdd6368fd0a6f45e0bea1--node-13.3.0_1.catalina.bottle.tar.gz
==&gt; Pouring node-13.3.0_1.catalina.bottle.tar.gz
==&gt; Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==&gt; Summary
🍺  /usr/local/Cellar/node/13.3.0_1: 4,663 files, 59MB

~
% npm install -g npm
/usr/local/bin/npx -&gt; /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -&gt; /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../../../lib/node_modules/npm/man/man1/npm-access.1
npm ERR! dest /usr/local/share/man/man1/npm-access.1
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npm-access.1' -&gt; '/usr/local/share/man/man1/npm-access.1'
npm ERR! File exists: /usr/local/share/man/man1/npm-access.1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/manabu/.npm/_logs/2019-12-18T07_51_00_280Z-debug.log
</code></pre></div>
<p dir="auto">I confirmed that this happened again when I ran <code class="notranslate">brew reinstall node</code>.</p>
<p dir="auto">Actually as the output said, I successfully ran it  with <code class="notranslate">--force</code> but I think that just showing these logs is better than removing the <code class="notranslate">npm</code> command.</p>
<p dir="auto"><strong>Edit (2020/01/11):</strong></p>
<blockquote>
<p dir="auto">Actually as the output said, I successfully ran it  with <code class="notranslate">--force</code></p>
</blockquote>
<p dir="auto">More specifically, I did these steps:</p>
<ol dir="auto">
<li>Restore <code class="notranslate">npm</code> command that was removed by <code class="notranslate">npm install -g npm</code>
<ul dir="auto">
<li>Since I use Homebrew for managing Node.js, I ran <code class="notranslate">brew reinstall node</code> to restore it</li>
</ul>
</li>
<li>Run <code class="notranslate">npm install -g --force npm</code> as the output mentioned</li>
</ol>
<h3 dir="auto">Steps to Reproduce</h3>

<ul dir="auto">
<li>n/a</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>

<ul dir="auto">
<li>Updating npm is successful</li>
</ul>
<h2 dir="auto">Who</h2>

<ul dir="auto">
<li>n/a</li>
</ul>
<h2 dir="auto">References</h2>

<ul dir="auto">
<li>n/a</li>
</ul>