illegal operation on a directory

(Vikas Chhabra) #1

Getting this error while installing anything globally in macbook pro, OS:10.14.4

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/yargs-parser-e8326649/lib’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/dist’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/debug-998c4072/src’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/yargs-6f32225d/lib’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/yargs-6f32225d/locales’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/lib’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/lib/adapters’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/lib/cancel’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/lib/core’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/axios-eda39365/lib/helpers’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/semver-37c62f9a/bin’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/parse-json-65147b18/vendor’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/ea/e1’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/8c/64’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/0e/92’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/45/2f’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/0f/eb’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/de/c5’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/4b/0d’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/b8/12’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/6b/2e’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/19/29’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/04/5f’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/09/7b’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/f4/80’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/38/75’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/30/8a’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/is-buffer-937904f0/test’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/de/de’aging/is-buffer-937904f0/test’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/ed/3f’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/localtunnel-a2ad7fff/bin’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/1d/6a’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/10/4a’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/62/0e’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/72/55’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/96/bd’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/localtunnel-a2ad7fff/lib’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/77/c9’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/35/c7’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/example’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/bb/a6’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/localtunnel-a2ad7fff/test’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/lib’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/dotdot/abc’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/module_dir/xmodules/aaa’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/module_dir/ymodules/aaa’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/module_dir/zmodules/bbb’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/node_path/x/aaa’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/node_path/x/ccc’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/node_path/y/bbb’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/node_path/y/ccc’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/pathfilter/deep_ref’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/precedence’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/precedence/aaa’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/precedence/bbb’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/baz’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/browser_field’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/dot_main’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/dot_slash_main’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/incorrect_main’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/invalid_main’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/multirepo’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/multirepo/packages/package-a’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/multirepo/packages/package-b’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/other_path/lib’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/normalize-package-data-3c598e2e/lib’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/6d/15’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/quux/foo’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/same_names’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/62/19’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/ff/90’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/same_names/foo’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/12/06’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/debug-bf57117b/dist’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/0d/07’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/9b/fa’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/debug-bf57117b/src’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/symlinked/_/node_modules’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/99/e9’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/symlinked/_/symlink_target’

npm WARN tar EISDIR: illegal operation on a directory, open ‘/usr/local/lib/node_modules/.staging/resolve-261bc2ac/test/resolver/without_basedir’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha512/d9/74’aging/resolve-261bc2ac/test/resolver/without_basedir’

Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/apple/.npm/_cacache/content-v2/sha1/21/35’staging/resolve-261bc2ac/test/resolver/without_basedir’

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/apple/.npm/_logs/2019-03-26T13_26_38_817Z-debug.log

0 Likes

(John Gee) #2

Hi @vikas-chhabra!

There is an open bug about ownership issues after using sudo with global installs, and some work-arounds: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

It is good practice to avoid using sudo with npm, but this does require a little extra work. Your three main options are:

  1. change the ownership of the global install location
  2. change the location of the global install location to somewhere you own, by changing where you install node and npm (node version managers typically do this)
  3. change the location of the global install location to somewhere you own, by changing npm configuration
0 Likes

(system) closed #3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

0 Likes