Kim Vu
Kim Vu

Reputation: 668

Cant find \node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node

I have tried to get the tensorflow.js library to work for days now.

I have installed on my computer

This is the steps I've done to produce the error:

  1. Create empty folder
  2. npm init inside the folder
  3. npm install --save @tensorflow/tfjs-node
  4. created a index.js file
  5. added 1 line : require('@tensorflow/tfjs-node')
  6. tried to run node index.js

got this error:

C:\Users\kim_1\Desktop\workplz>node index.js
internal/modules/cjs/loader.js:1003
  return process.dlopen(module, path.toNamespacedPath(filename));
             ^

Error: The specified module could not be found.
\\?\C:\Users\kim_1\Desktop\workplz\node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1003:18)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Users\kim_1\Desktop\workplz\node_modules\@tensorflow\tfjs- 
    node\dist\index.js:44:16)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

my package.json

{
  "name": "workplz",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@tensorflow/tfjs-node": "^1.3.0"
  }
}

Upvotes: 5

Views: 6225

Answers (3)

Codemaker2015
Codemaker2015

Reputation: 1

This might be the issue with Node and Tensorflow versions.

You can resolve it by upgrading the node version to 16.13 and @tensorflow/tfjs-node to 3.12.0.

Upvotes: 0

Kim Vu
Kim Vu

Reputation: 668

Update to the case:

@tensorflow/[email protected] has issues with Node version 12.13.0 (source https://github.com/tensorflow/tfjs/issues/2341)

Had to use @tensorflow/[email protected] with Node version 10.16.3

Upvotes: 4

edkeveked
edkeveked

Reputation: 18371

It is related to the version of tfjs-node. Installing a specific version such as @tensorflow/[email protected] will fix the issue.

Uninstall the latest package

npm uninstall --save @tensorflow/tfjs-node

And install the version 1.2.3

npm install --save @tensorflow/[email protected]

Upvotes: 4

Related Questions