【问题标题】:node does not recognize the r exe startup pathnode 不识别 r exe 启动路径
【发布时间】:2021-03-25 20:34:45
【问题描述】:

我正在尝试在节点中使用 r-integration 包,

在我的环境“PATH”变量中,我有 r 的路径

C:\apps\R-3.6.2\bin\x64;

由于 IT 原因,我无法将 r 安装到程序文件中。

当我在节点中运行它时

const R = require('r-integration');

let result = R.executeRCommand("max(1,2,3)");
console.log(result);

我收到一个错误

未捕获的错误:ENOENT:没有这样的文件或目录,lstat 'C:\Program Files\R'

有没有办法让当前的 r 路径工作?

谢谢

【问题讨论】:

    标签: node.js


    【解决方案1】:

    不幸的是,除了将R 移动到程序文件目录之外,您似乎无能为力。如果你看一下source-code,路径是硬编码的:

    if (fs.lstatSync("C:\\Program Files\\R").isDirectory()){
        // Rscript is installed, let's find the path (verison problems)
        installationDir = "C:\\Program Files\\R";
    

    您当然可以分叉存储库并更改代码以允许自定义路径甚至更好 - 创建拉取请求以使目录可配置。

    【讨论】:

    猜你喜欢
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 2019-08-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 2022-01-04
    • 2014-04-11
    相关资源
    最近更新 更多