node.js - 后端tensorflow初始化失败错误: Could not locate the bindings file

标签 node.js tensorflow.js

我在 ubuntu 机器上尝试使用 Tensorflow 时收到此错误。这是新文件夹中的全新 npm 安装。我已经尝试过其他帖子的建议,但仍然无法得到它。我有什么遗漏的吗?

Initialization of backend tensorflow failed Error: Could not locate the bindings file. Tried: → /var/nodejs/tensor/node_modules/@tensorflow/tfjs-node/build/tfjs_binding.node, ... etc

Node :v10.12.0

npm:6.7.0

package.json

{
  "name": "tensor",
  "scripts": {
    "start": "node algo.js"
  },
  "dependencies": {
    "@tensorflow/tfjs-node": "*"
  }
}

算法.js

const tf = require('@tensorflow/tfjs-node');

最佳答案

以下步骤之一可能有助于解决您的问题:

  • 对依赖项进行全新安装
    • 删除 node_modules 文件夹
    • 重新运行npm install
  • (重新)安装node-gyp:
    • sudo npm install -g node-gyp
  • 通过 sudo 安装依赖项
    • sudo npm install
    • 如果此步骤有效,则您的目录结构很可能存在权限问题。您可能想查看this question讨论如何解决该问题。

关于node.js - 后端tensorflow初始化失败错误: Could not locate the bindings file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56092265/

相关文章:

javascript - 如何在客户端从服务器(Node JS 和 Express)接收和使用 JSON 对象?

javascript - Imgur 通过客户端 JavaScript 上传,但不通过 Node.js。困惑的

javascript - "export default from"不适用于 Babel React

javascript - 将预测张量转换为图像

tensorflow - 如何在 tensorflow.js 中获取/设置监督模型的权重?

javascript - Sequelize 尝试将数据输入到未知列 [Postgres]

node.js - 使用 Node/Express 将文件流式传输给用户下载

typescript - 使用 Typescript 导入时,TFJS 抛出 TS2411 作为错误

javascript - requestAnimFrame 被多次执行

javascript - 在javascript中从本地文件系统加载Tensorflow js模型