Reputation: 668
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:
npm init
inside the foldernpm install --save @tensorflow/tfjs-node
index.js
filerequire('@tensorflow/tfjs-node')
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
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.
Download Node 16.13
Upgrade @tensorflow/tfjs-node using the following command,
npm install @tensorflow/[email protected]
Upvotes: 0
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
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