npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.38k stars 3.11k forks source link

🐞 [BUG] "npm ERR! cb() never called!" or "Exit handler never called" #417

Closed darcyclarke closed 3 years ago

darcyclarke commented 4 years ago

*Updated* as of 01/15/2021

Note: Please read [this doc](https://github.com/npm/cli/wiki/%22cb()-never-called%3F-Exit-handler-never-called%3F-I'm-having-the-same-problem!%22) before filing a new issue.

mateusgms commented 3 years ago

I've got this error trying install dependencies using yarn

MorningK commented 3 years ago

I got this error when i was running npm install node -v v14.16.0 npm -v 6.14.11 2021-04-09T07_51_38_305Z-debug.log

bvaradha commented 3 years ago

I got the same error on using this on actions on npm login. I am using mac OS as runner machine. npm login --scope=@ --registry=https:///npm/ npm login --scope=@ --registry=https:///npm/ shell: /bin/bash -e {0} env: NPM_CONFIG_USERCONFIG: /Users/XXXXXXX/actions-runner/_work/_temp/.npmrc NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX npm notice Log in on https:///npm/ npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at: npm ERR! https://github.com/npm/cli/issues 2021-04-09T11:20:51.1659890Z npm ERR! cb() never called! 2021-04-09T11:20:51.1661290Z 2021-04-09T11:20:51.1663470Z npm ERR! This is an error with npm itself. Please report this error at: 2021-04-09T11:20:51.1665150Z npm ERR! https://github.com/npm/cli/issues 2021-04-09T11:20:51.1783800Z 2021-04-09T11:20:51.1785570Z npm ERR! A complete log of this run can be found in:

I am on macOS. npm -version 7.7.6 $ node --version v15.14.0

Prajwal-Adhav commented 3 years ago

Updated as of 01/15/2021

Note: Please read [this doc](https://github.com/npm/cli/wiki/%22cb()-never-called%3F--I'm-having-the-same-problem!%22) before filing a new issue or adding a comment to this thread. Hello Everybody I am also encountering with the issue of npm ERR! cb() never called! I will give all the possible data that I have regarding this error:- O.S-Windows 10 Version 20H2 OS build-19042.746 npm version-v6.14.12 Node version-v14.16.1 While I was trying to download an external dependency for a React Web application I typed "npm install" in the node terminal and after some time this error popped up. This error tells that there is an error with npm itself. Below is the screenshot and log file of the same.

Screenshot (122)

2021-04-10T07_21_59_124Z-debug.log

PolybitRockzz commented 3 years ago

npm-not-working I was trying to create a React app for my personal project, but then this error pops up whenever I'm in the middle of downloading react-dom. I see several people facing this issue, so I think this is a problem with npm itself. Please help us.

PolybitRockzz commented 3 years ago

I found a quick fix. Don't know why it worked, but if you're on Windows, fixing the problem is as simple as going to the Control Panel > Uninstall a program, then selecting Node.js and clicking Repair. It works!

sunshu commented 3 years ago

Update npm to the latest version fixed my question

woody-li commented 3 years ago

Same error, already repair Node.js.

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'i'
0 verbose cli ]
1 info using npm@7.9.0
2 info using node@v14.16.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 16ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\proj\.npmrc Completed in 0ms
10 timing config:load:project Completed in 0ms
11 timing config:load:file:C:\Users\Administrator\.npmrc Completed in 15ms
12 timing config:load:user Completed in 15ms
13 timing config:load:file:C:\Users\Administrator\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setEnvs Completed in 0ms
17 timing config:load Completed in 47ms
18 timing npm:load:configload Completed in 47ms
19 timing npm:load:setTitle Completed in 0ms
20 timing npm:load:setupLog Completed in 0ms
21 timing npm:load:cleanupLog Completed in 0ms
22 timing npm:load:configScope Completed in 0ms
23 timing npm:load:projectScope Completed in 0ms
24 timing npm:load Completed in 63ms
25 timing config:load:flatten Completed in 16ms
26 timing arborist:ctor Completed in 15ms
27 timing arborist:ctor Completed in 0ms
28 timing idealTree:init Completed in 93ms
29 timing idealTree:userRequests Completed in 0ms
30 silly idealTree buildDeps
31 silly fetch manifest @babel/core@^7.13.10
32 http fetch GET 200 https://npm.org/@babel%2fcore 5655ms
//Hide some 200 package request.
45 silly fetch manifest babel-loader@^8.2.2
46 http fetch GET 200 https://npm.org/babel-loader 12799ms
47 silly fetch manifest webpack@^5.28.0
48 timing npm Completed in 155688ms
49 error cb() never called!
50 error This is an error with npm itself. Please report this error at:
51 error <https://github.com/npm/cli/issues>
keshaviagg commented 3 years ago

I think we have many reports of the same so these should all be duplicates.

423

425

442

451

455

465

Afaik this is resolved by force-clearing the cache and upgrading / updating to the latest npm version.

its not working still facing the same issue

cramirez201 commented 3 years ago

cb() never called! During installation of new Angular project...

node -v: v14.16.1

npm -v: 7.10.0

SO: W10 Pro x64

Version: 20H2

image

Log: 2021-04-16T16_50_36_767Z-debug.log

Help pls!

Karmavil commented 3 years ago

Hi. thanks for this note it was helpful:

Updated as of 01/15/2021

Note: Please read [this doc](https://github.com/npm/cli/wiki/%22cb()-never-called%3F--I'm-having-the-same-problem!%22) before filing a new issue or adding a comment to this thread.

I'm not going to give you too many details basically because I will probably give you wrong or not related information but I solved this issue that in my case it was related with this specific package as a dependency: amplify-cli (npm intall --save amplify-cli)

This is what happened

Details:

I understand this errors are specific, but maybe it could be helpful if this thing about @types/ is the problem

Important

Now I'm in a nightmare called Try npm install @types/graphql if it exists so take you time and think twice if you're gonna do that 🙅🏽 I cannot remember how did I solve this before

Solved

Jesus! that was horrible.. The only way I could solve that try to intall bulls~~ was restarting the container after npm install --save but I did it before without restart and it did not work.. I cannot imagine if it is a problem with VScode, angular, npm, cache.. you name it. Luck for me it was a container

hamzakilic commented 3 years ago

I got same error. and FIXED IT. I was trying to dockerize a nodejs project with a docker file. and package.json. on my ubuntu machine there is no problem, but on CI/CD machine (centos,debian) almost fails to dockerize

Tried Steps:

My problem:

My problem was at TCP level. some of the TCP connections to registry.npmjs.org was returning RESET. with tcpdump I saw that if npm install fails cb() never called, I got TCP RESET packets from registry.npmjs.org ips. if npm install success, then no TCP RESET from registry.npmjs.org ips. I dont know why TCP RESET occurs. big network problem

My Solution: I putted registry.npmjs.org behind of an NGINX proxy on K8 and changed dockerfile npm install ====> npm install --strict-ssl=false (because nginx will return a default ssl)

docker build -t tag myproject --add-host registry.npmjs.org:nginxip . (redirect all npm install trafic to your nginx)

below is the sample K8 ingress


apiVersion: v1
kind: Namespace
metadata:
  name: gitlab
  labels:
    app.kubernetes.io/name: gitlab
    app.kubernetes.io/part-of: gitlab
---
apiVersion: v1
kind: Service
metadata:
  name: npm-service
  namespace: gitlab
spec:
  externalName: registry.npmjs.org
  type: ExternalName
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-npm-gitlab
  namespace: gitlab
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/upstream-vhost: "registry.npmjs.org"
    nginx.ingress.kubernetes.io/ssl-passthrough: "false"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: registry.npmjs.org
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: npm-service
                port:
                  number: 443`

`
KogaiIrina commented 3 years ago

Hi! I got this error when I was running npm install node -v v14.16.0 npm -v 7.10.0


I solved this problem by updating my npm

HomyeeKing commented 3 years ago

the only suck thing I know is that the warning message of npm publish is indirect and not clear when you have not verify your email, just tell that they haven't verified the email, not something like security policy thing and package version problem...

KZRepository commented 3 years ago

npm i npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at: npm ERR! https://github.com/npm/cli/issues

fetch GET 304 https://registry.npmjs.org/grunt-cssnano 784ms (from cache) 1900 timing metavuln:packument:grunt-cssnano Completed in 786ms 1901 timing metavuln:load:security-advisory:grunt-cssnano:EtYBVUQGQLlhlpJr8KS/6Ije2vBT1OrDb4ZylGjBbqEpHu5oNhsP45j3VEbnmDsxSDP8IWOiIk4/CNRyBk/RpQ== Completed in 1ms 1902 timing metavuln:cache:put:security-advisory:grunt-cssnano:6zfI7LzZ7jhTaIHReTadx2z1+1e771qctuX2ezhF2HjxeHbwezKe6xIw4RwD9LlZN7IMyqdkoz3KNhgkx78nwQ== Completed in 10ms 1903 timing metavuln:calculate:security-advisory:grunt-cssnano:EtYBVUQGQLlhlpJr8KS/6Ije2vBT1OrDb4ZylGjBbqEpHu5oNhsP45j3VEbnmDsxSDP8IWOiIk4/CNRyBk/RpQ== Completed in 797ms 1904 timing auditReport:init Completed in 24937ms 1905 timing reify:audit Completed in 27613ms 1906 http fetch GET 200 https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz 25743ms 1907 timing reifyNode:node_modules/caniuse-lite Completed in 27883ms 1908 timing npm Completed in 43488ms 1909 error cb() never called! 1910 error This is an error with npm itself. Please report this error at: 1911 error https://github.com/npm/cli/issues

Ubaid-Ali commented 3 years ago

Worked for me but I don't know is it true or not,

I was getting the same error when I was trying to install "netlify-cli" command is C:Users>MyName>npm install netlify-cli -g, I upgraded npm version LTS to LATEST with this command >npm i -g npm@latest, Still not work then, I just deleted the log file from here ~/AppData/Local/npm-cache/_logs/2021-05-19T18_46_01_599Z-debug.log using git bash, $ rm ~/AppData/Local/npm-cache/_logs/2021-05-19T18_46_01_599Z-debug.log, which was showing with the error in cli, Try again, Installed Successfully.

RedHoodJT1988 commented 3 years ago

Hello, I ma receiving this error while using WSL2 Ubuntu 20.04. I have installed node and npm via nvm. I am trying to run npx create-react-app projectname but I keep running into the issue. I am not sure what is causing it as I have the latest version of both npm and npx. Any assistance on this would be very helpful. Thanks.