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


(Lilian) #41

$ npm install
Unhandled rejection RangeError: Maximum call stack size exceeded
at RegExp.test ()
at D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\node_modules\aproba\index.js:38:16
at Array.forEach ()
at module.exports (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\node_modules\aproba\index.js:33:11)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:37:3)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
at flatNameFromTree (D:\TTFdownloads\nodejs\ndoe_global\node_modules\npm\lib\install\flatten-tree.js:39:14)
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! D:\TTFdownloads\nodejs\node_cache_logs\2018-10-01T05_59_58_919Z-debug.log

what’s wrong ???who can tell me how to solve this erro…i have tried many methods,but it still like this

(Daniela Valero) #42

Hello, I also can reproduce this error:

npm verb lock using /Users/dayvaler/.npm/_locks/staging-02645998c96d1929.lock for /Users/dayvaler/workspace/dhl/pt/node_modules/.staging
npm timing audit compress Completed in 1937ms
npm info audit Submitting payload of 176216bytes
npm timing audit submit Completed in 2604ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 2602ms
npm timing audit body Completed in 2ms
npm timing action:extract Completed in 25617ms
npm timing action:finalize Completed in 16350ms
npm timing npm Completed in 143302ms
npm ERR! cb() never called!

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

Under npm 6.1 >

The weird behaviour in my case is that it just stopped working, and starting to crash. I already set the ulimit to unlimited or 1024 or 2000. Still no solution.

Could it be that npm is trying to use more resources than the ones that my computer has available, and therefore crashes? In the activity monitor I see that when I run an install npm uses more than 100% of the cpu.

I have

MacBook Pro (Retina, 15-inch, Late 2013)
with High Sierra 10.12.6 (16G1510)

The only solution I got was to downgrade to npm 5

(John Dixon) #43

This error occurs even on the latest release.

CentOS Linux release 7.5.1804

$ node --version

$ npm --version

npm ERR! cb() never called!

(Logan Allred) #44

Would it be possible to get a special build of npm with extra debug logging or something to help those of us that experience this regularly to help diagnose it?

Once it starts happening, it is very reproducible and breaks almost every time. I try downgrading npm version, changing Node version, various things until eventually it starts to work again, but the same fixes don’t seem to work every time.

I used to be able to downgrade back to either 5.5 or 5.6 and get working again, but lately with Node 10 that doesn’t always work either.
It takes anywhere from 10 minutes to hours before I can get back working again. It leaves the node_modules in a bad state where sometimes another npm install or npm update will fix it, and sometimes I have to manually delete folders from node_modules and keep re-installing broken packages one by one until my app or tests work again. Removing node_modules completely just causes it fail again, usually about the same place.

It certainly happens either much more often or only on my projects with large dependency trees.

I would be more than happy to install a custom build of npm next time it happens or run with a custom build for a while so that when it happens we will have better odds of finding and fixing the root cause. I’ve been fighting this issue for almost a year, since somewhere in the 5.6 or 5.7 timeframe.

(Luke Pighetti) #45

On LTS node 8.12.0 and npm 6.4.1 I was getting the cb() never called error when trying to do this command in a mono-repo

$ create-react-app my-app --scripts-version=react-scripts-ts

I was able to proceed by using $ n 8.11 which installed 8.11.4 and 5.6.0

The install script now works.

I am on Mac OS X 10.13.6 (17G65)

(Josh Sharpe) #46

osx 10.14, updated npm to 6.4.1 and got this cb() error.

(Joel Chen) #47

I’ve had this problem on my Mac since npm version 5.8.0 and I’ve been stuck at using npm 5.6.0.

I’ve finally got something that seems to point the issue to the number dependencies.

On my machine, with Node 10.9.0 and npm 6.4.1, I got a package.json that fails with this.

If I remove some dependencies, then npm install succeeds.

For example, removing enzyme alone helps.

Removing a bunch of other smaller packages also helps.

Mac is a Mid 2015 MackBook Pro.

MacOS High Sierra 10.13.6.

ulimit output:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1418
virtual memory          (kbytes, -v) unlimited

(No One) #48

i fixed the problem by

npm config rm proxy
npm config rm https-proxy

(Chuck Sigo) #49

I was receiving this error when attempting to ‘npm install’ an Aurelia CLI project I had built. I discovered the source of the problem was the package.json had a dev dependency on Gulp and was referencing it via “github:gulpjs/gulp#4.0”. This was failing as the Gulp team apparently made this inaccessible since my project was initially created. Changing the reference to “^4.0.0” fixed the issue.

(Adam Nielsen) #50

I just got this error also when trying to use create-react-app. Weirdly the actual npm command that fails works if I run it in a new folder (after npm init -y), it’s only when create-react-app launches it that it fails. Maybe it wants a specific version of some package that triggers a bug?

Force cleaning the cache does nothing and ulimit is not conservative so I’m not really sure what it could be. I tried downgrading from 6.4.1 to npm 6.3.0, 6.0.0 and 5.8.0 but they all have the same error.

Is anyone else able to run create-react-app v2.1.1 successfully under Linux?

EDIT: Realised v1.5.2 wasn’t the latest so updated to create-react-app v2.1.1 but with no change. Also tried downgrading to Node 10.9 instead of Node 11.1, but this made no difference either.

(Evan Lucas) #51

I’ve been digging into this over the past couple hours and have found a way to reliably reproduce the issue (at least on my machine).

Using the gist from the OP, running the following reproduces it 100% of the time for me:

ulimit -n 100
rm -rf node_modules package-lock.json && npm cache clear --force
npm i

https://github.com/npm/cli/blob/59e5056a2129cb2951f4ff3b657ada20657f01a7/lib/install.js#L554 seems to be failing somehow.

What’s really strange is that the exit event is being emitted on process with code set to 0 before that step in the chain finishes, so it’s almost like node is just dropping the queued up work of reading all of the package.json files for each dependency.

I also saw the line above it fail to run to completion once or twice.

I’ll keep digging and see what I can find though…

(Kat Marchán) #52

Hey y’all!

If you’re still experiencing this, we released a new npm@next and I’m wondering if any of y’all that can reliably reproduce this could test that version out and see if it helps. Try it with this:

$ npx npm@next install

If that doesn’t work, there’s also the Canary with a separate set of patches that you can try using this line:

$ npx npmc install

Let me know if either of those work!

(Cory Jones) #53

I’ve been able to reproduce the issue and tried both of these options, but still see the error from the original post.

(Riju Chatterjee) #54

May I know the steps to change the reference?

(Chuck Sigo) #55
  1. Open package.json
  2. Search for: "gulp": "github:gulpjs/gulp#4.0"
  3. Replace with: "gulp": "^4.0.0"

(Matthew B White) #56

I’ve hit this issue this morning when building a docker image for an express.js based app.
(very similar to https://nodejs.org/en/docs/guides/nodejs-docker-webapp/)

Running the npx npm@next install appears to have fixed this for me locally.

ERROR: cb() never called!
(FreWoN) #58

I tried to npm install discord.js and I got cb() never called! what can I do?

(Colin Rotherham) #59

Hi Kat.

I’ve set up two machines (one Mac mini, one MacBook) with:

Node.js v8.14.0
NPM 6.6.0-next.0

Both are macOS 10.14.1
Both use Homebrew to install Node

Both installing https://github.com/alphagov/govuk-prototype-kit via:
rm -rf node_modules && npm install --force -ddd

One of them gets the dreaded “npm ERR! cb() never called!” and one doesn’t.

Console output (silly logging) here:

Is there anything else I can provide to help debug?

(Colin Rotherham) #60

Now trying canary:

rm -rf node_modules && npx npmc install --force -ddd

Different error now:

npm ERR! code ENFILE
npm ERR! errno -23
npm ERR! syscall scandir
npm ERR! ENFILE: file table overflow, scandir '/Users/colin/.npm/_npx/29779'
npm verb exit [ -23, true ]

Full silly log here:

Maximum open file limit reached?

(Colin Rotherham) #61

Confirming this as the fix: