index.js file
R("message.R")
.data("hello world", 20)
.call(function(err, d) {
if (err) console.log('err:', err);
console.log('hiiii:', d);
});
message.R file
Print('ankit is here')
In command line, when running node index.js
, getting error spawn Rscript ENOENT
events.js:174 throw er; // Unhandled 'error' event ^
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)