【问题标题】:Nodejs app on Heroku "error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory"Heroku 上的 Nodejs 应用程序“加载共享库时出错:libffi.so.6:无法打开共享对象文件:没有这样的文件或目录”
【发布时间】:2022-01-05 14:29:18
【问题描述】:

我有一个名为“Main”的可执行文件,我想在 heroku 上的节点应用程序中运行它。为此,我使用此功能

function run(code, params) {
  const { execFileSync } = require('child_process');
  const child = execFileSync('/app/Main', params ? [code, params] : [code], {
    timeout: timeout * 1000,
    cwd: __dirname,
    stdio: 'pipe',
  })
  if (child.status === null) {
    return `child status null`
  }
  return child.stdout.toString()
}

但它给了我这个错误。

./Main: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory

我在运行时也收到此错误

heroku run bash -a "appname"

然后尝试

./Main

有没有办法解决这个问题?根据我的经验,heroku 文件系统非常受限制,并且主要是只读访问。我可以用 .profile 或类似的东西以某种方式将旧版本卷曲到正确的位置吗?

【问题讨论】:

    标签: node.js heroku spawn heroku-cli libffi


    【解决方案1】:

    我想通了。我必须从使用 libffi7 而不是 libffi6 的 ubuntu 版本编译二进制文件,并将 libffi7 加载到 heroku 根目录下的 .Aptfile 中

    【讨论】:

      猜你喜欢
      • 2020-12-24
      • 2015-06-07
      • 2019-02-16
      • 2015-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多