npm ERR! cb() never called! - Permission Denied

What I Wanted to Do

npm install within one of my nodejs repos

What Happened Instead

Unhandled rejection Error: EACCES: permission denied, open '/Users/jpavlic1/.npm/_cacache/content-v2/sha512/4b/49/c6dc22c442263f20bc6ab73b53587ff789145dc812f0e8a303c6728c721aed6e3d8e1667a1561d165027d6dc352b220c7fa85ac93c80abab8678b1347d51'

npm ERR! cb() never called!

Reproduction Steps

npm install in any project. I’ve tried this in multiple repos and I’m getting the same error.

Details

I also tried npm cache clear and just manually rm -rf ~/.npm to no avail. As far as I can tell everyone should have permission to read from this example file:

-r--r--r--  1 jpavlic1  admin  2469 Jul 29 16:18 2a6b4aae3af87b9460f4a6b7bad8201bd689e2d4e3ba79c24b1827b34e6850f05cf9d00af1f5152ccebc91f0a9602ba6afb925efbe22fac96c958900013a

I also get the error if I specify a --cache to somewhere in /tmp.

Platform Info

$ npm --versions
{ npm: '6.10.2',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.12.0',
  openssl: '1.0.2p',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.2',
  v8: '6.2.414.66',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

Well that’s interesting.

Can you share a link to the project? Does this happen with the same projects on other machines?

Can you upload the npm-debug.log file that was generated?

I had originally tried in an enterprise project that you won’t be able to see, but I tried installing https://www.npmjs.com/package/openid-client this morning and I got the same errors. I’m uploading that log for you so that you can repro. It does seem to be something specific to my machine, as other people can still install both of those projects without issue. Thanks for the help! 2019-07-30T14_01_59_692Z-debug.log (1008 Bytes)

1 Like

Okay, so I managed to get past this by uninstalling my current version of node 8 and installing a newer version within nvm. For reference that version was node v8.12.0 (npm v6.10.2). I installed node v8.16.0 (npm v6.4.1). Perhaps there is an issue in npm version 6.10.2? Happy to provide any other details should you decide to investigate further.

Even though @isaacs made an attempt to fix this issue, it’ll continue to bite even with npm 6.10.2 as long as people such as yourselves have permission corrupted caches from prior runs of sudo npm install -g ... for other projects.

To help users such as these, npm should sense the EACCES error and output the proper recommendation (which in your case is to run sudo chown -R $USER ~/.npm) before repeating the command.

1 Like

Good call.

I had a similar problem.
When scanning the package, this information appears:

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! cb() never called!
npm ERR! This is an error with npm itself.

What can I do for it?

I resolved the error by executing npm cache clean -f,
but i think it is so bad that executing the script every time .

Can you please post a new bug and include your npm-debug.log file? This is a different problem than the original post in this thread, even though the error wording is the same.

I just tried to reproduce but failed.:dizzy_face:
:thinking:
If I encounter this bug again, I will follow your instructions.

1 Like