title: Error: spawn sh ENOENT Node.js
body: <p>I am trying to trigger PIFM on my raspberry Pi by tweets from a specific twitter account using node.js. However when I run twitpifm.js on the command line:</p>
  
  <pre><code>node twitpifm.js
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>events.js:141
        throw er; // Unhandled 'error' event
        ^
  
  Error: spawn sh ENOENT
      at exports._errnoException (util.js:874:11)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
      at onErrorNT (internal/child_process.js:344:16)
      at doNTCallback2 (node.js:439:9)
      at process._tickCallback (node.js:353:17)
      at Function.Module.runMain (module.js:469:11)
      at startup (node.js:134:18)
      at node.js:961:3
  </code></pre>
  
  <p>I am using this version of PIFM on my PI2 </p>
  
  <p><a href="https://github.com/asmello/fm_transmitter" rel="nofollow noreferrer">https://github.com/asmello/fm_transmitter</a></p>
  
  <p>I have written a script (test.sh) that will start PIFm from command line without parameters </p>
  
  <pre><code> #!/bin/bash
      /home/pi/PIFm/fm_transmitter/bin/Release/fm_transmitter music.wav 103.50
  </code></pre>
  
  <p>I am aware that I need to need to use a child_process within my node.js to activate this shell script but am having trouble with it; </p>
  
  <p>First I invoke child process with: </p>
  
  <pre><code>var spawn = require('child_process').spawn // child process.spawn 
  </code></pre>
  
  <p>I then try to trigger the shell with the following: </p>
  
  <pre><code>function thisTweet(){
  
      spawn('sh', ['test.sh'], {  // shell script I want to run.
      cwd:' /home/pi/Desktop/Twitter', // current working directory where my twitpifm.js file is 
      env: Object.assign({}, process.env, { PATH: process.env.PATH + '/home/pi/PIFm/fm_transmitter' }) //this sets a path to where test.sh is
      })
  </code></pre>
  
  <p>Any suggestions would be great!</p>