title: nodejs: child process does not execute process.on('message')
body: <p>im sending messages between parent process and child process. the parent process works as expected as it sends and receives messages from child process, but the child process is only able to send message and not receive them</p>
  <p><em>app.js</em></p>
  <pre><code>import { fork } from 'child_process';
  
  const child = fork('./script.js');
  
  child.on('message', msg =&gt; console.log('msg from child :', msg));
  
  child.send({ msg: 'node' }, () =&gt; console.log('parent sent msg'));
  </code></pre>
  <p><em>script.js</em></p>
  <pre><code>process.on('message', msg =&gt; console.log('from parent :', msg));
  
  process.send({ msg: 'child' }, () =&gt; console.log('child sent msg'));
  </code></pre>
  <p>output in terminal</p>
  <pre><code>(node:7852) ExperimentalWarning: The ESM module loader is experimental.
  parent sent msg
  (node:9008) ExperimentalWarning: The ESM module loader is experimental.
  child sent msg
  msg from child : { msg: 'child' }
  </code></pre>
  <p>the callback passed to <code>child.send</code> is not reliable and does not indicate the message being sent, so i've read</p>