How to fix "npm ERR cb() never called"

I've started using GitHub Actions to test projects as well as running builds. Heroku is part of this playground. While working, I stumbled across an issue that took some time to fix. Sharing here my notes for others to benefit. When you come across npm ERR cb() never called, you might want to try these steps to fix the issue:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <>

As mentioned, in my case it was on GitHub:

npm ERR! cb() never called!

From researching the issue, I've learned this also appears to happen a lot on other npm packages like React Native and Meteor but also on services such as Heroku. I've discovered various solutions to fix the issue I'd like to share:

Clearing the NPM Cache & Upgrading NPM #

  1. If this issue comes up on your local development machine, it might pay to clear the cache:

    npm cache clean -force
  2. Secondly, ensure you are running the latest version of npm:

    npm install npm@latest -g
  3. Delete your node_modules before running an install too.

Fixing your NPM version #

It's been noted, that hard defining the required node version helped. For this, you will need to append this to your package.json:

"engines": {
"node": "0.8.x"

Doesn't fix it? #

If this doesn't fix it you could raise the question with details on Stackoverflow. Feel free to mention this site with the things you have already tried.


Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.