Unable to install packages on MacOS


(Albion Fung) #1

any attempt to install a package is giving me EISDIR error, here’s an example with

npm i -g newman

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/62/41'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/21/95'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/48/75'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/25/bc'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/93/b7'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/3c/7f'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/d6/50'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/4f/85'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/fb/58'

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/content-v2/sha512/a1/05'

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/Conanap/.npm/_logs/2019-01-29T17_54_39_590Z-debug.log

log:

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   'i',
1 verbose cli   '-g',
1 verbose cli   'newman' ]
2 info using npm@6.7.0
3 info using node@v8.11.2
4 verbose npm-session 5790d79f6cd6c51d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/newman 116ms
8 silly pacote tag manifest for newman@latest fetched in 134ms
9 timing stage:loadCurrentTree Completed in 171ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule newman@4.3.1 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/commander 125ms (from cache)
18 http fetch GET 304 https://registry.npmjs.org/eventemitter3 125ms (from cache)
19 http fetch GET 304 https://registry.npmjs.org/lodash 125ms (from cache)
20 silly pacote version manifest for commander@2.19.0 fetched in 135ms
21 silly resolveWithNewModule commander@2.19.0 checking installable status
22 silly pacote version manifest for eventemitter3@3.1.0 fetched in 138ms
23 silly resolveWithNewModule eventemitter3@3.1.0 checking installable status
24 silly pacote version manifest for lodash@4.17.11 fetched in 138ms
25 silly resolveWithNewModule lodash@4.17.11 checking installable status
26 http fetch GET 304 https://registry.npmjs.org/parse-json 36ms (from cache)
27 silly pacote version manifest for parse-json@4.0.0 fetched in 42ms
28 silly resolveWithNewModule parse-json@4.0.0 checking installable status
29 timing npm Completed in 995ms
30 error cb() never called!
31 error This is an error with npm itself. Please report this error at:
32 error <https://npm.community>

Attempts to downgrade npm with
npm install npm@6.4.1
and
npm install -g npm@6.4.1
have both failed. Thanks!


(Brian Thompson) #2

I did a quick search on “npm EISDIR” and found this SO post. Essentially, npm is trying to write to a file that is actually a directory, so the operation cannot be completed.

It looks like the cache may be in a defunct state. Try running npm cache clear and then installing the package globally again.


(Albion Fung) #3

Thanks for the help!
npm warned me that it auto-heals cache since v5, so I used --force; doesn’t seem to have fixed the problem:

npm i -g newman
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/Conanap/.npm/_cacache/tmp'

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/Conanap/.npm/_logs/2019-01-29T20_15_14_689Z-debug.log

in log:

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   'i',
1 verbose cli   '-g',
1 verbose cli   'newman' ]
2 info using npm@6.7.0
3 info using node@v8.11.2
4 verbose npm-session cb4b11b491f5f6e0
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 timing npm Completed in 581ms
8 error cb() never called!
9 error This is an error with npm itself. Please report this error at:
10 error <https://npm.community>

Thanks again for the help!


(Brian Thompson) #4

Can you install any other packages globally? npm i -g eslint for example?


(Albion Fung) #5

I an unable to; it’s the same error but with a different directory:
Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/Conanap/.npm/_cacache/content-v2/sha512/b9/fb’


(Brian Thompson) #6

Hmmm maybe your npm installation got corrupted.

My suggestion is to uninstall Node and use a version manager instead. You can still install packages globally, and they will be unique per node installation.

Personally, I don’t install packages globally at all (aside from npm), but I realize that there are different use cases out there.

If that doesn’t solve your problem then someone else could help I suppose.


(Albion Fung) #7

lol the name gave me a chuckle ahaha. I’ll actually try reinstalling node and npm and see if it helps. I appreciate your help!


(John Gee) #8

I wonder if it is an interaction with past use of sudo. I suggest trying:

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

The canonical topic to refer to is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

Reinstalling node will currently give you npm 6.4.1 and that solves the problem for some people.

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


(Albion Fung) #9

Hello! Thanks for the help!

I’ve seen that article too, but I wasn’t able to downgrade through npm (I don’t know why I thought that would work lol). Reinstalling node worked, thanks!


(system) closed #10

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