在NodeJS中运行R脚本时Spawn Rscript ENOENT错误

问题描述 投票:0回答:1

index.js文件

R("message.R")
.data("hello world", 20)
.call(function(err, d) {
     if (err) console.log('err:', err);
     console.log('hiiii:', d);
   });

message.R文件

Print('ankit is here')

在命令行中,在运行node index.js时出错,生成Rscript ENOENT错误>>

events.js:174抛出//未处理的“错误”事件^

错误:生成Rscript ENOENT在Process.ChildProcess._handle.onexit(内部/child_process.js:240:19)在onErrorNT(内部/child_process.js:415:16)在process._tickCallback(内部/进程/next_tick.js:63:19)在Function.Module.runMain(内部/模块/cjs/loader.js:834:11)在启动时(internal / bootstrap / node.js:283:19)在bootstrapNodeJSCore处(internal / bootstrap / node.js:623:3)在以下位置发出了“错误”事件:在Process.ChildProcess._handle.onexit(内部/child_process.js:246:12)在onErrorNT(内部/child_process.js:415:16)[...与原始堆栈跟踪匹配的行...]在bootstrapNodeJSCore(internal / bootstrap / node.js:623:3)

index.js文件R(“ message.R”).data(“ hello world”,20).call(function(err,d){if(err)console.log('err:',err); console.log('hiiii:',d);}); message.R文件Print('ankit is here')...

node.js express rscript
1个回答
0
投票

如果您也遇到相同的问题,那么在花费4-5个小时的时间后,我知道我们需要在您的本地计算机上安装R。 R的安装过程如链接中所述。install R in ubuntu

© www.soinside.com 2019 - 2024. All rights reserved.