I fixed this for myself by simply updating npm ( $> npm install -g npm )since I was getting warnings that packages expected a higher version of it anyways in the console output.
– racl101Oct 2 '15 at 15:14

Sept 29th? Is this error from the future? :) Thanks for the solution!
– JBCPSep 26 '13 at 21:09

1

if 6 was 9 ;) thanks, for the solution!
– Sönke RohdeSep 26 '13 at 21:24

1

Thanks! Definitely what I was looking for
– Kyle HotchkissSep 27 '13 at 2:37

3

You posted from the future! This was a serious bug indeed. ;/
– juanpacoSep 27 '13 at 12:36

2

45 upvotes (at the time of this writing) in the span of 22 hours :) Brilliant of you to preemptively post a new & current answer for an old but similar question. The Internet rocks!
– meetamitSep 27 '13 at 16:59

Do you have a specific version of "npm" specified under "engines" in your package.json? Sounds like NPM v1.2.15 resolved the issue (and Heroku has available). I was getting the same problem with "1.1.x".

Fantastic. That was bugging me for sure. Specified my npm version and it worked like a charm.
– Eric H.Jul 4 '13 at 1:46

17

IF YOU ARE EVER IN AUSTIN,TX, PLEASE LET ME BUY YOU A PIZZA! I'm sorry for the all caps, but it captures my current state of joy as a result of your answer. I would never have suspected that having that version specification for NPM was the culprit. Aidan, I hope you have a wonderful day.
– juanpacoJul 25 '13 at 14:01

I just had this exactly issue when trying to install the Sage theme for WordPress. When I ran npm install on the theme directory, it failed.

Looking in the dependencies in package.json, I could see that the engine I was running for Node was out of date. Running node -v on the command line showed that I was on v0.10.9, and the latest version of Sage requires >= 0.12.0

I had the same problem with NPM version 1.3.11, and solved it simply by re-running the exact same command multiple times ("npm update -g" in my case). The error popped up for a different package on each subsequent run and eventually everything updated successfully.

For me at least, it seems like it was being caused by a network issue (corrupted downloads). I was also getting an error about an invalid package, which I was able to resolve by deleting all instances of "tmp.tgz".

Edit: (Probably unrelated, but in case this helps anyone: I was using Windows, and started a command prompt as an Administrator after receiving the initial error).

Since posting this I've seen a lot of people saying they've had the same experience on Unix and Mac (multiple attempts eventually bypass the issue). Don't know if the problem is networking related or not, but it seems widespread.
– Sven VikingSep 27 '13 at 6:58

If you are allowing major or minor version updates in your packages.json via ^ or ~, remove those characters thoughout the file and try another npm install. If it works that time then you'll be alright after you have the fun of narrowing down which package is causing the problem.

Picking up where mdp left, the problem is with node 0.10.19 and npm 1.3.11

I found the easiest way to manage the downgrade to keep things going smoothly to be NVM, here is a nice tutorial on how to use it. I had my server environment modified and running correctly downgrading from 0.10.19 to 0.10.18 in a matter of minutes with NVM.

I encountered the same problem on my Mac and I have tried all methods I can find: upgrade to latest Node, clean cache, remove _node_mudules_ directory, but all have no effect. Eventually, I believed it was the problem of Node environment, so I degraded my Node to an old LTS version 6.14.1, then the problem disappeared. This is what I do:

I suggest: Switch to Yarn! - Yarn is a package manager which uses the same package.json file and node_modules folder as npm.

With npm I had the same problem: On a CentOS 6 install I got the ERR cb() never called error repeatedly and could not find a way to make npm reliably complete installation of some packages (like webpack for example). - Yarn works flawlessly, even on flaky network connections.

I've often had problems with npm install inside a Docker container (typically running on an Ubuntu host). yarn install has unblocked me in two different projects when npm install has failed! Wish I could know why, however...
– Jamie BirchApr 4 at 16:00

Check if you have multiple versions of the npm command in your system path variable.

In my case, I had a version in the Node install directory and an older one in the npm globals install directory (called prefix in the npm config file). So I checked npm config get prefix for the location and deleted the link and the npm folder from node_modules. (Deleting the other one might also work, depending on the order in your PATH variable.)

Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).