title: NodeJs script with child_process spawn on Windows, why I need 'shell: true' for ENOENT error?
body: <p>I'm using this code:</p>
  
  <pre><code>const {
    spawn
  } = require('child_process');
  
  let info = spawn('npm', ["-v"]);
  
  info.on('close', () =&gt; {
    console.log('closed');
  }
  </code></pre>
  
  <p>But I have this error:</p>
  
  <pre><code>events.js:182
        throw er; // Unhandled 'error' event
        ^
  
  Error: spawn npm ENOENT
      at exports._errnoException (util.js:1022:11)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
      at onErrorNT (internal/child_process.js:366:16)
      at _combinedTickCallback (internal/process/next_tick.js:102:11)
      at process._tickCallback (internal/process/next_tick.js:161:9)
      at Function.Module.runMain (module.js:607:11)
      at startup (bootstrap_node.js:158:16)
      at bootstrap_node.js:575:3
  </code></pre>
  
  <p>If I use instead:</p>
  
  <pre><code>let info = spawn('npm', ["-v"], {shell: true});
  </code></pre>
  
  <p><strong>it works!</strong></p>
  
  <p>But why I need <code>shell: true</code>? I need also to see the stdout of that spawn, so I'm also using this:</p>
  
  <pre><code>let info = spawn('npm', ["-v"], {shell: true, stdio: 'inherit'});
  </code></pre>
  
  <p>It's correct?</p>