Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error on npm install as npm ERR cb() never called

I have set a proxy in npm global config. On installing any package I am getting following error. Below is my node and npm version: npm: 6.13.4 node: v12.16.1

As I am behind proxy, what else is required to overcome this issue. Every help will be appreciated. I have also tried by updating node version, removing and after restart setting proxy again, but none of that worked.

    C:\test>npm i level-db-helper
    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!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-03-03T04_51_02_995Z-debug.log

    C:\test>npm get proxy
    http://my-proxy.com:8080

    C:\test>npm get https-proxy
    http://my-proxy.com:8080

    C:\test>

Below is my log file content

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   'level-db-helper'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session b2d05546852e6399
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 timing npm Completed in 3615ms
8 error cb() never called!
9 error This is an error with npm itself. Please report this error at:
10 error <https://npm.community>
like image 777
Hemendra Avatar asked Mar 03 '20 05:03

Hemendra


People also ask

Why npm install is failing?

This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.

How to fix CB() never called error in NPM?

Here are some things you can try to fix the cb () never called error: Let’s see how you can fix the error with the steps above. An outdated npm cache may trigger the error, so you can try to fix the error by clearing the cache. Once the cache is cleared, run the npm install command again.

Why do I get NPM err error when installing a package?

When we install a node packages from package.json file and package-lock.json file is corrupted due to some reasons like node.js version is updated to the latest, we will see an error like this in our terminal. npm WARN tar zlib error: unexpected end of file npm ERR! cb() never called! npm ERR! This is an error with npm itself.

How to fix “NPM install is not working” error in Ubuntu?

To fix this error, first delete the package-lock.json file and run the following command. Now, try to install your packages using the npm install command.

How to fix NPM error 2020-04-19t23_20_56_316z?

A complete log of this run can be found in: npm ERR! /Users/saigowtham/.npm/_logs/2020-04-19T23_20_56_316Z-debug.log To fix this error, first delete the package-lock.json file and run the following command. Now, try to install your packages using the npm install command.


Video Answer


3 Answers

Finally I found the culprit of this issue by my own research, It was due to inaccessible proxy url, so after changing the npm proxy and https-proxy by following command I resolved this issue.

(You need administrative rights to execute this command)

npm config set proxy http://your-proxy-url.com:PORT_NUMBER
npm config set https-proxy http://your-proxy-url.com:PORT_NUMBER
like image 114
Hemendra Avatar answered Oct 24 '22 15:10

Hemendra


One of the reasons for this issue is that you have package-lock.json file in your project directory. So, you may have to delete or rename the package-lock.json file from the directory and then run the npm install command. Best option is to delete this file.

Hope it will work for you.

like image 27
Yisal Khan Avatar answered Oct 24 '22 14:10

Yisal Khan


I got the same error when, npm install from docker. deleted the un-used docker images, using the following commands

docker image prune
docker image rm <imageId>

It solved the issue for me

like image 38
shafeervn Avatar answered Oct 24 '22 14:10

shafeervn