[Resolved] ERR! cb() never called! Error with npm itself? SOLVED

In this post, I will discuss solutions for a very common nightmare level issue faced by almost every node developer.

This Angular post is compatible with Angular 4 upto latest versions, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11, Angular 12 and Angular 13

This issue generally appears while installing the npm packages for a new project setup or sometimes an existing one. The error that strikes and leave you in a head hitting situation reads like this:

npm ERR! cb() never called!

Error with npm itself

So we know this is some error with NPM itself and it’s been there for a long and not yet resolved.

Let’s have a look at various methods to overcome this issue and save numerous hours looking at other things.

How to resolve cb() never called! during npm install?

You can resolve this issue by following the various methods given below.

Method 1 – NPM Verify and Clean Cache

Method 2 – Delete package-lock.json and Node Modules folder

Method 3 – Install One Then Others Trick

Method 4 – If Error in NPM, use PNPM

Find detailed procedures below. Make sure you follow each step and I am making sure you leave this page with this issue resolved!

 

Method 1 – NPM Verify and Clean Cache

Run the following commands one by one to verify and clean npm cache from system-defined folders:

npm cache verify
 npm cache clean --force

Now try doing npm install

 

Method 2 – Delete package-lock.json and Node Modules folder

Simply delete the package-lock.json and delete the node_modules folder. Deleting the node_modules folder may take time so instead, rename it to something else like node_modules_old.

Now try running npm install

 

Method 3 – Install One Then Others Trick

Pick 2 to 3 package names from your package.json file and install them individually instead of npm install. For example;

npm install abc
npm install xyz

etc.

If it succeeds, it will create node_modules folder and package-lock.json and also confirm if you are able or not able to get a few of the packages downloaded from artifactory in your network.

 

Method 4 – If Error in NPM, use PNPM

Yes, you heard right, you can quickly install pnpm it is the best substitute for npm. It is more optimised and uses fewer resources and also uses less time to install the package when done again and again.

Step 1 – Install PNPM

You can follow the steps given here for multiple platforms. Using npm install globally as follows:

npm install -g pnpm

Step 2 – Do PNPM Install now

Now simply execute pnpm install in your folder.

Check more details here.

Now, your issue should be resolved with all packages installed.

 

Hope this was helpful…share which method worked in your case… Thanks.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments