npm: "Cannot find module internal/errors" : <p>On a MacBook with the latest version of NodeJS, I am trying to update npm:</p>

<pre><code>npm install npm@latest
</code></pre>

<p>The error message is:</p>

<pre><code>npm ERR: code MODULE_NOT_FOUND
npm ERR: Cannot find module 'internal/errors'
npm ERR: A complete log of this run can be found in:
npm ERR:     /Users/alexander/.npm/_logs/2017_09_15_12_35_47_079Z-debug.log
</code></pre>

<p>and the referenced log file reads</p>

<pre><code>0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'npm@latest' ]
2 info using npm@5.3.0
3 info using node@v8.5.0
4 verbose npm-session 5db7f116200ca64c
5 verbose stack Error: Cannot find module 'internal/errors'
5 verbose stack     at Function.Module._resolveFilename (module.js:527:15)
5 verbose stack     at Function.Module._load (module.js:476:23)
5 verbose stack     at Module.require (module.js:568:17)
5 verbose stack     at require (internal/module.js:11:18)
5 verbose stack     at evalmachine.&lt;anonymous&gt;:36:16
5 verbose stack     at Object.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
5 verbose stack     at Module._compile (module.js:624:30)
5 verbose stack     at Object.Module._extensions..js (module.js:635:10)
5 verbose stack     at Module.load (module.js:545:32)
5 verbose stack     at tryModuleLoad (module.js:508:12)
5 verbose stack     at Function.Module._load (module.js:500:3)
5 verbose stack     at Module.require (module.js:568:17)
5 verbose stack     at require (internal/module.js:11:18)
5 verbose stack     at Object.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/graceful-fs.js:3:27)
5 verbose stack     at Module._compile (module.js:624:30)
5 verbose stack     at Object.Module._extensions..js (module.js:635:10)
6 verbose cwd /Users/alexander/Documents/Source/Repos
7 verbose Darwin 16.7.0
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "npm@latest"
9 verbose node v8.5.0
10 verbose npm  v5.3.0
11 error code MODULE_NOT_FOUND
12 error Cannot find module 'internal/errors'
13 verbose exit [ 1, true ]
</code></pre>

<p>The same worked ok on the windows machine.</p>

<p>What is the problem and how can I fix this?</p>
