Unhandled rejection Error: EISDIR: illegal operation on a directory


(Weijiezhu) #1

What I Wanted to Do

I want to install a package.

sudo npm install spy-debugger -g

What Happened Instead

npm reported some errors as follows:

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/44/57’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/1c/96’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/34/c7’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/ae/b2’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/26/f8’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/74/dd’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/49/86’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/55/97’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/8a/9d’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open β€˜/Users/joneszhu/.npm/_cacache/content-v2/sha512/dc/e1’

Reproduction Steps

sudo npm install spy-debugger -g

Details

2019-01-30T02_32_47_461Z-debug.log (2.2 KB)

Platform Info

$ npm --versions
{ npm: '6.7.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.0.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.2',
  v8: '6.6.346.24-node.5',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

(Pavel Filippov) #2

Same for me. Just updated the npm to v6.7.0 and cannot update any package since.
Please fix it!


(John Gee) #3
  1. Downgrading npm to 6.4.1 solves the issue for some people. The main issue tracking the problem is:

Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

  1. Using sudo introduces a number of potential problems with npm. There are suggestions with approaches to avoid sudo in the following issue, but not yet confirmed they will help:

(John Gee) #4

I just found a good summary post from @larsgw in this comment: