0
votes

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)

1

1 Answers

1
votes

If you are also facing the same issues, after spending 4-5 hour time, I get to know that we need to install R in your local machine. the procedure of installing R is as mentioned in the link.install R in ubuntu

After that type R, you will get R environment

Install

install.packages("dplyr");