title: Spawn Rscript ENOENT error while running R script in NodeJS
body: <p>index.js file</p>
  
  <pre><code>R("message.R")
  .data("hello world", 20)
  .call(function(err, d) {
       if (err) console.log('err:', err);
       console.log('hiiii:', d);
     });
  </code></pre>
  
  <p>message.R file</p>
  
  <pre><code>Print('ankit is here')
  </code></pre>
  
  <p>In command line, when running <code>node index.js</code>, getting error spawn Rscript ENOENT </p>
  
  <p>events.js:174
        throw er; // Unhandled 'error' event
        ^</p>
  
  <blockquote>
    <p>Error: spawn Rscript ENOENT
        at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
        at onErrorNT (internal/child_process.js:415:16)
        at process._tickCallback (internal/process/next_tick.js:63:19)
        at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
        at startup (internal/bootstrap/node.js:283:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) Emitted 'error' event at:
        at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
        at onErrorNT (internal/child_process.js:415:16)
        [... lines matching original stack trace ...]
        at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)</p>
  </blockquote>