2

I'm receiving this error when trying to use tensorflow on an ubuntu box. It's a fresh npm install in a new folder. I've tried the suggestions from other posts but still can't get it. Is there something I'm missing?

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": "*"
  }
}

algo.js

const tf = require('@tensorflow/tfjs-node');
Andrew
  • 3,545
  • 4
  • 31
  • 37

1 Answers1

2

One of the following steps might help to fix your problem:

  • Do a clean installation of your dependencies
    • Delete the the node_modules folder
    • Rerun npm install
  • (Re)install node-gyp:
    • sudo npm install -g node-gyp
  • Install your dependencies via sudo
    • sudo npm install
    • If this step works, it is very likely that you are having a permission issue in your directory structure. You might want to check out this question on how to resolve the issue.
Thomas Dondorf
  • 23,416
  • 6
  • 84
  • 105