[crash] npm ERR! cb() never called!

cli
triaged
priority:medium

(Kat Marchán) #62

Hey y’all!

tl;dr try this: $ npx npmc@latest install

I’ve released a new npm canary with some patches that will stop dropping cb never called errors when certain error types pop up. Note that you may very well still get an error, but it should be more informative now, and I assume it’s going to be the ENFILE issue in most cases. I have a different idea for those, so if you confirm that, I can try the new thing and release a new canary.

Thanks y’all for your patience, I assure you this bug has been as exasperating for me as I imagine as it’s been for you. Kudos to @iarna for finally managing to reproduce it on her own server, which allowed her to do deeper debugging and come up with a patch.

Anyway, please let me know if you still get the cb never called with the canary!


cb() never called error
Can't install node-fetch
(Zxylina) #63

中国windows以及linux环境,复现:
rm -rf node_modules package-lock.json && npm cache clear --force
npm i
尝试了版本:
13:22:53 + npm --version
13:22:53 5.6.0
13:22:53 + node --version
13:22:53 v8.10.0

13:20:36 + npm --version
13:20:39 6.5.0
13:20:39 + node --version
13:20:39 v8.11.3

13:28:24 + npm --version
13:28:24 5.6.0
13:28:24 + node --version
13:28:24 v8.11.1

解决:
更换npm的镜像源:
1.临时使用

npm --registry https://registry.npm.taobao.org install express
1
2.持久使用

npm config set registry https://registry.npm.taobao.org
1
配置后可通过下面方式来验证是否成功
npm config get registry

npm info express
3.通过cnpm使用

npm install -g cnpm --registry=https://registry.npm.taobao.org
1
使用
cnpm install express

node采用源码包tar.gz安装,windows使用nvm安装
安装node之后会自动安装一个npm,如想安装指定版本npm:npm install -g npm@5.0.0


(Zxylina) #64

发现的原因是使用cnpm install,node_modules即可正常下载,不然会报错


(Gabriel Hayes) #65

Getting the same error (after a series of strange cryptic issues while trying to start up a new webpack project)

See error log:
https://pastebin.com/ui3Xk74W


(Kaifas Stromai) #66

Greetings, persons,
I am very new to node/npm/web development but I think I might have figured it out (at least for me (Windows 10 build 17763)).
When ever I ran npm install I noticied that Windows defender cpu usage would suddenly spike–so I added an exception in the settings and voila! no more cb() never called! Given this, I would posit that perhaps anti-malware processes are interfering with the install process?


(Kat Marchán) #67

Could you please try again using the canary?


(Rupesh H Bhurke) #68

Hi!

I received a similar error while trying:
npm install

Unhandled rejection Error: Command failed: C:\Program Files\Git\cmd\git.EXE checkout 4.0o D:\Rupesh\WorkData\Self\RnD\Node.js\json-forms\aurelia-formio\exam
error: pathspec '4.0' did not match any file(s) known to git.

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

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\Rupesh\AppData\Roaming\npm-cache\_logs\2019-01-03T10_59_11_787Z-debug.log

I cloned from: https://github.com/formio/aurelia-formio

cd aurelia-formio
npm install
cd example
npm install  <-- here I received this error!

My Node version is 10.14.2
My NPM version is 6.4.1
My OS is Microsoft Windows [Version 10.0.17134.472]

Kindly suggest workaround!

Thank you
Rupesh


(Lars Willighagen) #69

Seems like the 4.0 tag doesn’t exist anymore in the gulp repository, but is still required here.


(Kumavis) #70

verifying error improvement on canary :+1:

npm@6.6.0

npm ERR! cb() never called!

npmc@latest

npm ERR! EMFILE: too many open files, scandir '/home/user/.npm/_npx/31857'

Resimdeki Hatayı Anlayamadım..
npm ERR! This is an error with npm itself. Please report this error at: npm ERR! <https://npm.community>
(Peter Willert) #71

Confirming this observation.

I wonder if there is a way to let npmc run in some kind of a sequential install mode to work around the issue for now. :open_hands:


(Alexander Kirillov) #73

I hit this bug trying to create a new React app:

$ npx create-react-app react-demo

Platform info:

OS: Centos 6

$ node -v
v8.15.0

$ npm -v
6.4.1

This box is behind a proxy and the first time I tried to create an app the install hung with “WARNING! Your cache is running out of filedescriptors” messages in squid log. I could finish the install restarting squid several times.

Then I increased nofile limit for squid to 4096 in /etc/security/limits.conf, tried to recreate the app and got “npm ERR! cb() never called!” after timeout.

The error went away when I also increased nofile limit for the user account I used to create the app. So it looks like npm hits “number of files” limit and crashes with “cb() never called!” error after timeout being unable to get a new file descriptor.


(Kat Marchán) #74

Please refer further up the thread. The cb never called issue is fixed as of npm@6.6.0. You may hit a separate bug but that deserves a separate ticket.


(Alexander Kirillov) #75

Good to know it’s been fixed but nodejs-8 nodesource package comes with npm-6.4.1 and this can’t be easily fixed on rpm-based distros. The post may still be usefult to those stuck with nodejs-8 on RHEL and derivatives.


(Chris533) #76

sudo rm -rf /usr/local/lib/node_modules/

Then install npm/node again


(PDM) #77

Still getting the same error

$ npm i -g hint
Unhandled rejection Error: EACCES: permission denied, open '/home/pasquale/.npm/_cacache/index-v5/03/f6/db619231354326c85da546de337d3864014c0022bafdc387f0fa91391349'

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!     ~/.npm/_logs/2019-01-31T11_12_27_043Z-debug.log
$ npm -v                                                                                         
6.6.0

Here is the log for trying to install webhints (15.1 KB)


(Brian Thompson) #78

You are actually getting a “permission denied” error. npm is trying to write to a directory that it doesn’t have access to.


(Bruno Jouhier) #79

Got the bug today with npm 6.7.0, inside docker. Downgrading to npm 5.6.0 fixed the problem.


(Kat Marchán) #80

I ask that anyone still experiencing this bug in new ways please post a debug log or other clues as to what is happening.


cb() never called error
(Shaun) #81

I am still seeing this issue even after trying all suggested fixes and using the latest canary build.

Step 1/6 : FROM node:lts-alpine
 ---> 288d2f688643
Step 2/6 : WORKDIR /app
 ---> 8a03560b600e
Removing intermediate container 703ab6f8d0b2
Step 3/6 : COPY package.json /app/
 ---> dc5be0c8dceb
Removing intermediate container 5871edfea445
Step 4/6 : RUN npx npmc@latest install --verbose
 ---> Running in dc7923b313af

e[91me[0me[91mnpx: installed 426 in 14.098s
e[0me[91mnpme[0me[91m info it worked if it ends with ok
e[0me[91mnpme[0me[91m e[0me[91mverb e[0me[91mcli [ '/usr/local/bin/node',
e[0me[91mnpm verb e[0me[91mcli   '/root/.npm/_npx/1/bin/npmc',
npme[0me[91m verb clie[0me[91m   'install',
npm e[0me[91mverb clie[0me[91m   '--verbose' ]
e[0me[91mnpm infoe[0me[91m usinge[0me[91m npm@6.7.0-canary.1
npme[0me[91m infoe[0me[91m usinge[0me[91m node@v10.15.0
e[0me[91mnpme[0me[91m noticee[0me[91m CANARYe[0me[91m npmc is experimental software. If you find an issue, please file it in the main npm repository, and call out that you were using npmc.
e[0me[91mnpm e[0me[91mverb e[0me[91mnpm-session 7d5195dd96ffbb82
e[0me[91mnpm info lifecyclee[0me[91m box-office@1.0.0~preinstall: box-office@1.0.0
e[0me[91mnpm timinge[0me[91m e[0me[91mstage:loadCurrentTree Completed in 18ms
e[0me[91mnpme[0me[91m timinge[0me[91m stage:loadIdealTree:cloneCurrentTreee[0me[91m Completed in 1ms
e[0me[91mnpm timing stage:loadIdealTree:loadShrinkwrape[0me[91m Completed in 7ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/bootstrap-sass 333ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/@babel%2fregister 342ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/@babel%2fpreset-env 345ms
e[0me[91mnpm e[0me[91mhttp fetche[0me[91m GET 200 https://registry.npmjs.org/assets-webpack-plugin 343ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/@babel%2fplugin-proposal-object-rest-spread 353ms
e[0me[91mnpme[0me[91m http fetche[0me[91m GET 200 https://registry.npmjs.org/clean-webpack-plugin 346ms
......
e[0me[91mnpm e[0me[91mhttpe[0me[91m fetch GET 200 https://registry.npmjs.org/wordwrap 50ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/fast-levenshtein 53ms
e[0me[91mnpm httpe[0me[91m e[0me[91mfetch GET 200 https://registry.npmjs.org/rxjs 128ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/type-check 127ms
e[0me[91mnpm e[0me[91mhttp fetche[0me[91m GET 200 https://registry.npmjs.org/slice-ansi 49ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/chownr 43ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/ansi-regex 54ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/mississippi 49ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/bluebird 59ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/lru-cache 67ms
e[0me[91mnpm e[0me[91mhttp fetche[0me[91m GET 200 https://registry.npmjs.org/graceful-fs 71ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/promise-inflight 58ms
e[0me[91mnpm e[0me[91mhttp e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/move-concurrently 65ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/ssri 48ms
e[0me[91mnpm http e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz 58ms
e[0me[91mnpm e[0me[91mhttp fetch GET 200 https://registry.npmjs.org/y18n 47ms
e[0me[91mnpme[0me[91m e[0me[91mhttp fetch GET 200 https://registry.npmjs.org/is-extglob 42ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/ansi-wrap 48ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/array-union 58ms
e[0me[91mnpme[0me[91m e[0me[91mhttpe[0me[91m e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/dir-glob 62ms
e[0me[91mnpm e[0me[91mhttp e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/slash 72ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/cosmiconfig 82ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/is-resolvable 78ms
e[0me[91mnpm e[0me[91mhttp e[0me[91mfetch GET 200 https://registry.npmjs.org/cssnano-preset-default 97ms
e[0me[91mnpm e[0me[91mhttp fetch GET 200 https://registry.npmjs.org/unique-filename 172ms
e[0me[91mnpm http e[0me[91mfetch GET 200 https://registry.npmjs.org/source-list-map 82ms
e[0me[91mnpm httpe[0me[91m e[0me[91mfetch GET 200 https://registry.npmjs.org/bin-check 90ms
e[0me[91mnpm http e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/bin-version-check 90ms
e[0me[91mnpm e[0me[91mhttp fetch GET 200 https://registry.npmjs.org/download 90ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m e[0me[91mfetche[0me[91m GET 200 https://registry.npmjs.org/import-lazy 83ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/os-filter-obj 92ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/color-convert 85ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/p-try 95ms
e[0me[91mnpm http e[0me[91mfetch GET 200 https://registry.npmjs.org/jsonify 81ms
e[0me[91mnpm e[0me[91mhttp fetche[0me[91m GET 200 https://registry.npmjs.org/array-filter 85ms
e[0me[91mnpm e[0me[91mhttpe[0me[91m fetch GET 200 https://registry.npmjs.org/array-reduce 76ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/load-json-file 115ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/array-map 87ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/es-abstract 80ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/normalize-package-data 87ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/path-type 75ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/globule 79ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz 102ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/has-ansi 101ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz 99ms
e[0me[91mnpm http e[0me[91mfetch GET 200 https://registry.npmjs.org/fstream 90ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/nopt 114ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/osenv 96ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/semver/-/semver-5.3.0.tgz 102ms
e[0me[91mnpm httpe[0me[91m fetch GET 200 https://registry.npmjs.org/tar 95ms
e[0me[91mnpm http fetche[0me[91m GET 200 https://registry.npmjs.org/aws-sign2 89ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/aws4 104ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/caseless 102ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/extend 91ms
e[0me[91mnpm httpe[0me[91m fetche[0me[91m GET 200 https://registry.npmjs.org/combined-stream 101ms
....
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz 126ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz 3881ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000934.tgz 2164ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/core-js/-/core-js-2.6.3.tgz 2680ms
e[0me[91mnpm http fetch GET 200 https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz 11817ms
e[0me[91mnpm timing npm Completed in 41761ms
e[0me[91mnpm ERR! cb() never called!
e[0me[91m
npm ERR! This is an error with npm itself. Please report this error at:
npme[0me[91m ERR!     <https://npm.community>
e[0me[91m
e[0me[91mnpm ERR!e[0me[91m A complete log of this run can be found in:
npme[0me[91m ERR!e[0me[91m     /root/.npm/_logs/2019-02-04T17_53_12_844Z-debug.log
e[0mThe command '/bin/sh -c npx npmc@latest install --verbose' returned a non-zero code: 1

(Shaun) #82

For what it’s worth, the exact same application builds on Docker when using node:lts instead of node:lts-alpine. Hopefully that indicates something!