npm ci failed - child.send is not a function

cli
help-wanted
priority:low
triaged

(Artem) #1

What I Wanted to Do

I run npm ci on solaris.

What Happened Instead

Command failed.

-> % npm ci                                                
npm WARN prepare removing existing node_modules/ before installation
npm ERR! child.send is not a function
npm ERR! child.send is not a function
npm ERR! child.send is not a function
npm ERR! child.send is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/.npm/_logs/2018-07-10T13_03_36_059Z-debug.log

Reproduction Steps

Run npm ci on solaris.

Details

/tmp/.npm/_logs/2018-07-10T13_03_36_059Z-debug.log: https://pastebin.com/6RrqT7cC

Platform Info

$ npm --versions
6.1.0
$ node -p process.platform
sunos

Solaris SunOS 11.3
node: 8.9.1

Also failing with npm - 6.2.0


(Kat Marchán) #2

Does node not support child.send on Solaris? That’s a pretty serious omission. I’m surprised npm install works, too, since it should be hitting the same code path here. :thinking:


(Artem) #3

npm install work fine. I cam send any additional logs etc.


(Kat Marchán) #4

Can you try upgrading to npm@6.2.0 and see if it still reproduces?


(Artem) #5

I try, with 6.2.0 npm ci also crash


(Kat Marchán) #6

This stack trace is honestly just telling me that there’s a bug in the Solaris version of node. If you take a look at that stack trace, you’ll see that it’s literally Node itself missing that send method:

Can you try running this with node@10 and see if it works? This command will do it without you having to upgrade your node version:

$ npx -p node@10 npm ci

And let me know what you get from this. I don’t know why it would only happen sometimes, and I suspect the reason you get it with npm ci and not npm install is because the former is faster, and thus more likely to run into race conditions. If this problem keeps going, and still happens with the latest node version, I think you’ll have to file a bug with nodejs/node (or just look in their issue tracker for errors with a missing .send() method on ChildProcess instances).


(Artem) #7

$ npx -p node@10 npm ci failing:

Logs:

ld.so.1: node: fatal: libc.so.1: version 'ILLUMOS_0.8' not found (required by file /tmp/.npm/_npx/604522/lib/node_modules/node/bin/node)
ld.so.1: node: fatal: libc.so.1: open failed: No such file or directory
/usr/bin/npm: line 3: 604583: Killed

I create simple example.

index.js:

const childProcess = require('child_process');
const childModule  = require.resolve('./child');

const options = {
    env: process.env,
    cwd: process.cwd(),
};
const child = childProcess.fork(childModule, process.argv, options);

child.on('message', function(data) {
    console.log('m', data);
});

child.on('error', function(err) {
    console.log('e', err);
});

child.send({ date: Date.now() });

child.js:

process.on('message', function (data) {
    console.log('MES', data);
});

And it run success, console:

-> % node index.js
MES { date: 1532068611704 }
^C

(Artem) #8

I add console.log to on error callback:

And in logs receive:

npm ERR! child.send is not a function
unhandled err: { Error: spawn /usr/node/bin/node EAGAIN
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: 'EAGAIN',
  errno: 'EAGAIN',
  syscall: 'spawn /usr/node/bin/node',
  path: '/usr/node/bin/node',
  spawnargs: 
   [ '/usr/node/lib/node_modules/npm/node_modules/worker-farm/lib/child/index.js',
     '/usr/node/bin/node',
     '/usr/node/bin/npm',
     'ci' ] }

It seems like a problem with my system. Maybe need improve logs for detect similar problems?

And one more questions, I can limit worker number for npm ci with arguments or process.env?


(Artem) #9

After research I think it must be added maxConcurrentWorkers option to:

For customize over environment variables. In my case our company use virtual machines, and in:

require('os').cpus().length return 24. But it for all virtual machines and when npm ci runs it exceeds threads limit on virtual machine. P.S. npm ci with maxConcurrentWorkers = 24 use over 200 threads.


(system) #10

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.