node-worker-pool icon indicating copy to clipboard operation
node-worker-pool copied to clipboard

Nothing works :/

Open lordnynex opened this issue 11 years ago • 2 comments

This looks like a great library that has the basic things I need, however, I can't get it to work. Additionally all test cases are failing.

I've even tried running your example verbatim, the error message is always the same:

if (require.main === module) {
  var workerPool = new WorkerPool(
    8,                // number of workers
    process.execPath, // path to the node binary
    './worker.js',    // path to the worker script
    {
      // The initData object that is passed to each worker exactly once before
      // any messages get sent. Workers receive this object via their
      // onInitialize callback.
      initData: {someUsefulConstant: 42}
    }
  );

  workerPool.sendMessage({message: 'hai!'}).then(function(response) {
    console.log(response); // Prints the response object from the worker
  });

  workerPool.shutDown().then(function() {
    console.log('All worker processes have now been killed');
  });
}
child_process.js:715
    throw new TypeError('Incorrect value of args option');
          ^
TypeError: Incorrect value of args option
    at Object.exports.spawn (child_process.js:715:11)
    at new Worker (/home/lordnynex/test/node/worker/node_modules/node-worker-pool/Worker.js:10:29)
    at WorkerPool._bootNewWorker (/home/lordnynex/test/node/worker/node_modules/node-worker-pool/WorkerPool.js:29:16)
    at WorkerPool._eagerBootAllWorkers (/home/lordnynex/test/node/worker/node_modules/node-worker-pool/WorkerPool.js:40:10)
    at new WorkerPool (/home/lordnynex/test/node/worker/node_modules/node-worker-pool/WorkerPool.js:23:10)
    at Object.<anonymous> (/home/lordnynex/test/node/worker/test.js:17:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

As for test cases failing the error messages don't seem to offer much info. They all just say Error: pit() tests should return a promise. I'm assuming this is because instead of returning a promise it's crashing? I'd love to use this module but I'm not sure if my env is wrong or if theres a bug. Travis does show the build as passing though.

lordnynex avatar Jan 01 '15 22:01 lordnynex

which node version do you use?

doodzik avatar May 31 '15 10:05 doodzik

the README.md is not up-to-date - there's a pending pull request that's fixing it: https://github.com/jeffmo/node-worker-pool/pull/3... now would be nice that this pull request would be accepted ?

farialima avatar Dec 22 '15 17:12 farialima