title: Pass a packed JS file within an asar package to a spawned node child process
body: <p>When trying to spawn a node.js <code>child_process</code> from within my <a href="/questions/tagged/electron" class="post-tag" title="show questions tagged &#39;electron&#39;" rel="tag">electron</a> (previously atom-shell) that runs <code>node path/to/a/packed/file</code> I am getting <code>Cannot find module error</code> because the path is within the <code>app.asar</code> archive (where <a href="https://github.com/atom/asar" rel="nofollow">asar</a> is the tar-like archive format).</p>
  
  <pre><code>Error: Cannot find module 'C:\Program Files (x86)\my-app\resources\app.asar\bootstrap\daemon'
      at Function.Module._resolveFilename (module.js:336:15)
      at Function.Module._load (module.js:278:25)
      at Function.Module.runMain (module.js:501:10)
      at startup (node.js:129:16)
      at node.js:814:3
  </code></pre>
  
  <p>I understand this is because the unpatched node is trying to locate the <code>bootstrap/daemon</code> module within the archive, as though it is a physical file.</p>
  
  <p>Can someone who is more familiar with the asar documentation/code advise a workaround for this?</p>
  
  <p>I have also raised <a href="https://github.com/atom/electron/issues/2226" rel="nofollow">an issue/question</a> for this on the atom/electron GitHub repo.</p>