const { fork } = require('child_process');

let debugPort = 9229;

/**
 * spawnWorker
 *
 * @name spawnWorker
 * @function fork a new process in node
 * @access public
 */
module.exports = ({ workerPath }) => {
  debugPort += 1;
  return fork(workerPath, { execArgv: [`--debug-port=${debugPort}`] });
};

const { fork } = require('child_process');

let debugPort = 9229;

/**
 * spawnWorker
 *
 * @name spawnWorker
 * @function fork a new process in node
 * @access public
 */
module.exports = ({ workerPath }) => {
  debugPort += 1;
  return fork(workerPath, [], { execArgv: [`--debug-port=${debugPort}`] });
};

Fix for passing wrong arguments while calling fork function
Fix for passing wrong arguments while calling fork function

Options should be passed as third parameter
ref: https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options