What I Wanted to Do
Upgrade npm to its latest version. On my MacOS High Sierra I ran “sudo npm install -g n” hoping it would run the upgrade.
What Happened Instead
$ sudo npm install -g n
Password:
npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/n-3eb27508/bin’
Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/zharvey/.npm/_cacache/content-v2/sha512/9b/14’
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zharvey/.npm/_logs/2019-06-14T12_42_09_335Z-debug.log
I checked and “/Users/zharvey/.npm/_logs/2019-06-14T12_42_09_335Z-debug.log” is an empty log file!
Reproduction Steps
See above just run “sudo npm install -g n” on a High Sierra.
Details
This is my personal laptop and I have full access to everything on it.
Platform Info
Mac OS High Sierra 10.13.6
$ npm --versions
{ npm: '6.9.0',
ares: '1.14.0',
cldr: '33.0',
http_parser: '2.8.0',
icu: '61.1',
modules: '64',
napi: '3',
nghttp2: '1.29.0',
node: '10.4.0',
openssl: '1.1.0h',
tz: '2018c',
unicode: '10.0',
uv: '1.20.3',
v8: '6.7.288.43-node.7',
zlib: '1.2.11' }
$ node -p process.platform
darwin