npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

This is an error with npm itself. Please report this error

Console Log:

vaibhav in ~ $ sudo npm install -g node-gyp
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/har-schema-fc9ad66e/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-6c76b4c5/bin'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/minimist-e78c8d78/example'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-6c76b4c5/examples'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/minimist-e78c8d78/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-6c76b4c5/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/tar-329452c9/examples'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/semver-77ca2227/bin'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/tar-329452c9/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/tar-329452c9/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/draft-01'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/getpass-d625708f/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/isexe-3e66bccd/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/delayed-stream-1ebe4a1f/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/concat-map-fad2ed1b/example'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/core-util-is-79b3775b/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/dashdash-c12dc5c8/etc'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/fast-json-stable-stringify-af1df244/benchmark'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-traverse-66a328bb/spec'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/draft-02'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-stringify-safe-e2ac82bc/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/nopt-acfebe23/bin'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/which-fc058204/bin'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/fstream-8c40ee78/examples'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/concat-map-fad2ed1b/test'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/46/b3'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/79/e6'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/d5/38'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/5e/2f'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/ec/32'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/ea/57'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/23/76'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/31/18'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/b6/46'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/1b/15'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/39/89'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/f2/bd'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/8d/40'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/dashdash-c12dc5c8/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-traverse-66a328bb/spec/fixtures'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/combined-stream-81f32174/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/delegates-a76df3a6/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/nopt-acfebe23/examples'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/b5/77'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/60/8c'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/a1/ff'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/aa/9b'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/49/e3'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/21/5c'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/d9/6b'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/d0/f3'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/c6/49'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/b7/dd'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/88/e3'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/4e/5e'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/ce/a7'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/2f/e8'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/81/74'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/86/df'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/d5/f3'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/4d/dc'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/97/25'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/5a/98'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/14/f7'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/asynckit-8b08bcd5/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/fast-json-stable-stringify-af1df244/example'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/8a/07'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/58/c9'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/85/b3'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/nopt-acfebe23/lib'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/2f/b5'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/a5/f5'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/df/37'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/17/0e'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/a5/3e'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/ed/b8'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/da/fe'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/nopt-acfebe23/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/fstream-8c40ee78/lib'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/75/90'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/draft-03/examples'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/extsprintf-0efb3412/lib'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/2a/77'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/fast-json-stable-stringify-af1df244/test'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/f5/3e's/.staging/fast-json-stable-stringify-af1df244/test'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/9b/b8'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/51/63'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/.github'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/form-data-77ccd502/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/bin'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/draft-04'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/draft-00'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/data/win'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/request-9222d792/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/pylib/gyp'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/json-schema-b76200d9/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/pylib/gyp/generator'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/samples'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/tools/emacs'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/tools/emacs/testdata'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/tools/Xcode'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/gyp/tools/Xcode/Specifications'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/lib'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/src'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/test'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/test/fixtures'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/vaibhav/.npm/_cacache/index-v5/18/7b'

npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/node-gyp-08cf32f7/tools/gyp/pylib/gyp/generator'
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/vaibhav/.npm/_logs/2019-04-22T05_58_10_495Z-debug.log


Thanks. There is an open issue with installing global packages using sudo leaving behind files with the wrong ownership.

The short version is run this to fix the ownership, then try your install again:


sudo chown -R $(whoami) ~/.npm

The long version and canonical bug is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.