Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tfjs-node invalid installation/setup no such file or directory #7881

Closed
digimbyte opened this issue Jul 30, 2023 · 23 comments
Closed

tfjs-node invalid installation/setup no such file or directory #7881

digimbyte opened this issue Jul 30, 2023 · 23 comments

Comments

@digimbyte
Copy link

digimbyte commented Jul 30, 2023

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 (Up to date)
  • TensorFlow.js installed from (npm or script link): npm
  • TensorFlow.js version: 4.9.0

Describe the problem
Installation stalls on ENOENT: no such file or directory

Output:

npm ERR! code 1
npm ERR! path E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-4.9.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings
npm ERR! symlink ./lib/napi-v9 failed:  Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9
npm ERR!   * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk.
npm ERR! node:internal/process/promises:289
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR!
npm ERR! [Error: ENOENT: no such file or directory, copyfile 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll' -> 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll'] {
npm ERR!   errno: -4058,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'copyfile',
npm ERR!   path: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\deps\\lib\\tensorflow.dll',
npm ERR!   dest: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v9\\tensorflow.dll'
npm ERR! }
npm ERR!
npm ERR! Node.js v20.3.1
npm ERR!
npm ERR!     at ChildProcess.exithandler (node:child_process:419:12)
npm ERR!     at ChildProcess.emit (node:events:511:28)
npm ERR!     at maybeClose (node:internal/child_process:1098:16)
npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:304:5) {
npm ERR!   code: 1,
npm ERR!   killed: false,
npm ERR!   signal: null,
npm ERR!   cmd: 'node scripts/deps-stage.js symlink ./lib/napi-v9'
npm ERR! }

Provide the exact sequence of commands / steps that you executed before running into the problem
npm install @tensorflow/tfjs-node@latest

Any other info / logs
Seems that its unable to extract/setup the file and dll in its intended structure, following the folder behavior, I noticed ./lib/napi-v8 being created rather than ./lib/napi-v9 and the dll files were not present in a visible manor.
output log: Paste Bin

@gaikwadrahul8
Copy link
Contributor

gaikwadrahul8 commented Jul 31, 2023

Hi, @digimbyte

Thank you for bringing this issue to our attention and Please refer this similar issue #7341 and this comment, at the moment we don't have pre-built-binary for windows machine for latest version and last supported version is pre-built-binary/napi-v8/3.18.0/CPU-windows-3.18.0.zip please refer this link

At the moment workaround is to use older version 3.18 so please use below command, Let us know, Is it working as expected or not ?

If issue still persists with @tensorflow/tfjs-node@3.18.0, please let us know with error log to find out root cause for your issue. Thank you!

npm install --save-exact @tensorflow/tfjs-node@3.18.0

@digimbyte
Copy link
Author

digimbyte commented Jul 31, 2023

I'm not a big brain when it comes to this stuff, for now I'll use the workaround. hopefully that gets fixed, even though my server is running Debian, working on Windows is just easier. perhaps some sort of catch can be implemented where fallback files are requested via user prompt or a secondary step.

@digimbyte
Copy link
Author

unfortunately, it still failed with 3.18.0

397 timing reifyNode:node_modules/@tensorflow/tfjs-core/node_modules/seedrandom Completed in 893ms
398 timing reifyNode:node_modules/@tensorflow/tfjs-backend-webgl/node_modules/seedrandom Completed in 894ms
399 timing reifyNode:node_modules/@tensorflow/tfjs-backend-cpu/node_modules/seedrandom Completed in 893ms
400 timing reifyNode:node_modules/@tensorflow/tfjs/node_modules/yargs Completed in 913ms
401 timing reifyNode:node_modules/@tensorflow/tfjs-data Completed in 1001ms
402 timing reifyNode:node_modules/@tensorflow/tfjs-converter Completed in 1323ms
403 timing reifyNode:node_modules/@tensorflow/tfjs-backend-cpu Completed in 1499ms
404 timing reifyNode:node_modules/@tensorflow/tfjs-node Completed in 1544ms
405 timing reifyNode:node_modules/@tensorflow/tfjs-layers Completed in 1568ms
406 timing reifyNode:node_modules/@tensorflow/tfjs-backend-webgl Completed in 1720ms
407 timing reifyNode:node_modules/@tensorflow/tfjs Completed in 1997ms
408 timing reifyNode:node_modules/@tensorflow/tfjs-core Completed in 2575ms
409 timing reifyNode:node_modules/core-js Completed in 3239ms
410 timing reify:unpack Completed in 3242ms
411 timing reify:unretire Completed in 0ms
412 timing build:queue Completed in 2ms
413 timing build:link:node_modules/@mapbox/node-pre-gyp/node_modules/mkdirp Completed in 7ms
414 timing build:link:node_modules/@mapbox/node-pre-gyp Completed in 8ms
415 timing build:link:node_modules/detect-libc Completed in 7ms
416 timing build:link:node_modules/@tensorflow/tfjs Completed in 7ms
417 timing build:link:node_modules/@tensorflow/tfjs-node/node_modules/rimraf Completed in 7ms
418 timing build:link:node_modules/nopt Completed in 7ms
419 timing build:link:node_modules/@mapbox/node-pre-gyp/node_modules/rimraf Completed in 7ms
420 timing build:link Completed in 8ms
421 info run @tensorflow/tfjs-node@3.18.0 install node_modules/@tensorflow/tfjs-node node scripts/install.js
422 info run @tensorflow/tfjs-node@3.18.0 install { code: 1, signal: null }
423 warn cleanup Failed to remove some directories [
423 warn cleanup   [
423 warn cleanup     'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node',
423 warn cleanup     [Error: EPERM: operation not permitted, rmdir 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\deps\include\tensorflow'] {
423 warn cleanup       errno: -4048,
423 warn cleanup       code: 'EPERM',
423 warn cleanup       syscall: 'rmdir',
423 warn cleanup       path: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\deps\\include\\tensorflow'
423 warn cleanup     }
423 warn cleanup   ]
423 warn cleanup ]
424 timing reify:rollback:createSparse Completed in 456ms
425 timing reify:rollback:retireShallow Completed in 2ms
426 timing command:install Completed in 27351ms
427 verbose stack Error: command failed
427 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:53:27)
427 verbose stack     at ChildProcess.emit (node:events:511:28)
427 verbose stack     at maybeClose (node:internal/child_process:1098:16)
427 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
428 verbose pkgid @tensorflow/tfjs-node@3.18.0
429 verbose cwd E:\Projects\backend-server
430 verbose Windows_NT 10.0.19045
431 verbose node v20.3.1
432 verbose npm  v9.6.7
433 error code 1
434 error path E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node
435 error command failed
436 error command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
437 error CPU-windows-3.18.0.zip
437 error https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
438 error * Downloading libtensorflow
438 error
438 error * Building TensorFlow Node.js bindings
438 error symlink ./lib/napi-v9 failed:  Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9
438 error   * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk.
438 error node:internal/process/promises:289
438 error             triggerUncaughtException(err, true /* fromPromise */);
438 error             ^
438 error
438 error [Error: ENOENT: no such file or directory, copyfile 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll' -> 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll'] {
438 error   errno: -4058,
438 error   code: 'ENOENT',
438 error   syscall: 'copyfile',
438 error   path: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\deps\\lib\\tensorflow.dll',
438 error   dest: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v9\\tensorflow.dll'
438 error }
438 error
438 error Node.js v20.3.1
438 error
438 error     at ChildProcess.exithandler (node:child_process:419:12)
438 error     at ChildProcess.emit (node:events:511:28)
438 error     at maybeClose (node:internal/child_process:1098:16)
438 error     at ChildProcess._handle.onexit (node:internal/child_process:304:5) {
438 error   code: 1,
438 error   killed: false,
438 error   signal: null,
438 error   cmd: 'node scripts/deps-stage.js symlink ./lib/napi-v9'
438 error }
439 verbose exit 1
440 timing npm Completed in 27675ms
441 verbose unfinished npm timer reify 1690786503855
442 verbose unfinished npm timer reify:build 1690786517075
443 verbose unfinished npm timer build 1690786517075
444 verbose unfinished npm timer build:deps 1690786517076
445 verbose unfinished npm timer build:run:install 1690786517086
446 verbose unfinished npm timer build:run:install:node_modules/@tensorflow/tfjs-node 1690786517086
447 verbose code 1

@gaikwadrahul8
Copy link
Contributor

gaikwadrahul8 commented Jul 31, 2023

Hi, @digimbyte

I see currently you're using the Node.js v20.3.1 so could you please go with LTS node version for Windows Installer node-v18.17.0-x64.msi option ?

Please refer this official documentation for TensorFlow.js Node.js bindings Windows troubleshooting and node-gyp - Node.js native addon build tool instructions from here for Windows machine

node-gyp requires that you have installed a compatible version of Python, one of: v3.7, v3.8, v3.9, or v3.10.

Could you please try above instructions with @tensorflow/tfjs-node@3.18.0 and let us know, Is it resolving your issue or not ? If not please share error log after following above instructions ? Thank you!

@digimbyte
Copy link
Author

incrementally I rolled back the versions with the following:

E:\Projects\backend-server> python --version
Python 3.10.9

using nvm I rolled back to v18

E:\Projects\backend-server> node -v
v18.17.0

running command: E:\Projects\backend-server> npm install --save-exact @tensorflow/tfjs-node@3.18.0

npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-3.18.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
npm ERR! * Downloading libtensorflow
npm ERR! * Building TensorFlow Node.js bindings
npm ERR! symlink ./lib/napi-v9 failed:  Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9
npm ERR!   * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk.
npm ERR! node:internal/process/promises:288
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR!
npm ERR! [Error: ENOENT: no such file or directory, copyfile 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll' -> 'E:\Projects\backend-server\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll'] {
npm ERR!   errno: -4058,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'copyfile',
npm ERR!   path: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\deps\\lib\\tensorflow.dll',
npm ERR!   dest: 'E:\\Projects\\backend-server\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v9\\tensorflow.dll'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.17.0
npm ERR!
npm ERR!     at ChildProcess.exithandler (node:child_process:419:12)
npm ERR!     at ChildProcess.emit (node:events:514:28)
npm ERR!     at maybeClose (node:internal/child_process:1091:16)
npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR!   code: 1,
npm ERR!   killed: false,
npm ERR!   signal: null,
npm ERR!   cmd: 'node scripts/deps-stage.js symlink ./lib/napi-v9'
npm ERR! }

seems its failing on creation of the symbolic link to napi-v9, is it supposed to be v8? as earlier I saw that folder being generated

@digimbyte
Copy link
Author

I did some version testing, earliest version I can install is 3.1.0 but 3.2.0 yields the same error:

npm ERR! code 1
npm ERR! path E:\Projects\TensorFlow\node_modules\@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-3.2.0.zip
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings
npm ERR! symlink ./lib/napi-v9 failed:  Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9
npm ERR!   * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk.
npm ERR! node:internal/process/promises:288
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR!
npm ERR! [Error: ENOENT: no such file or directory, copyfile 'E:\Projects\TensorFlow\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll' -> 'E:\Projects\TensorFlow\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll'] {
npm ERR!   errno: -4058,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'copyfile',
npm ERR!   path: 'E:\\Projects\\TensorFlow\\node_modules\\@tensorflow\\tfjs-node\\deps\\lib\\tensorflow.dll',
npm ERR!   dest: 'E:\\Projects\\TensorFlow\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v9\\tensorflow.dll'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.17.0
npm ERR!
npm ERR!     at ChildProcess.exithandler (node:child_process:419:12)
npm ERR!     at ChildProcess.emit (node:events:514:28)
npm ERR!     at maybeClose (node:internal/child_process:1091:16)
npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR!   code: 1,
npm ERR!   killed: false,
npm ERR!   signal: null,
npm ERR!   cmd: 'node scripts/deps-stage.js symlink ./lib/napi-v9'
npm ERR! }

@gaikwadrahul8
Copy link
Contributor

Hi, @digimbyte

Thank you for doing different versions testing from your end and good to hear that it's working with 3.1.0 so Could you please help me with the exact versions details for which you're able to install from your end for @tensorflow/tfjs-node, python version and node-gyp version that information will help us to dig more into this issue further for Windows machine ?

If you help us with exact steps you followed to work @tensorflow/tfjs-node with 3.1.0 version that would be great help for us to fix this issue as soon as possible.

Thank you!

@digimbyte
Copy link
Author

digimbyte commented Aug 3, 2023

Python:
3.10.9
node-gyp:
9.4.0
Node:
18.17.0
npm:
9.6.7
Windows 10:
10.0.19045 Build 19045

simple (empty) project, run npm command:
npm install --save-exact @tensorflow/tfjs-node@3.1.0

I verified I have C++ CMake tools installed from Visual Studio
image_2023-08-04_065102416

on complete:

npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

added 133 packages, and audited 134 packages in 3m

7 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

@gaikwadrahul8
Copy link
Contributor

Hi, @digimbyte

Thank you for helping us with above detailed details and will dig more into this issue. It's good to hear that it's working with @tensorflow/tfjs-node@3.1.0, if your issue got resolved please feel free to close this issue and for future update you can follow this issue #7341 where we'll update once we got the new update from our concerned team with latest version of @tensorflow/tfjs-node for Windows machine. Thank you!

@laurens-vrh
Copy link

laurens-vrh commented Aug 4, 2023

I have a similar problem. After downgrading to nodejs version 18.17.0 and using npm install --save-exact @tensorflow/tfjs-node@3.1.0, I was able to get it installed. However, when I run my project, I instantly get this error:

node:internal/modules/cjs/loader:1340
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\D:\Documents\Programmeren\Projecten\tfjs-latijn\node_modules\@tensorflow\tfjs-node\lib\napi-v7\tfjs_binding.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (D:\Documents\Programmeren\Projecten\tfjs-latijn\node_modules\@tensorflow\tfjs-node\dist\index.js:60:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  code: 'ERR_DLOPEN_FAILED'
}

I have no idea what this means. The tfjs_binding.node is present in that folder. I tried rebuiling the package locally with npm rebuild @tensorflow/tfjs-node --build-from-source, which succeeded, but I still got the same error. Is there a solution to this?

I have resolved this using this comment. The problem was the missing tensorflow.dll file in that napi-v7 folder.

@seongho-98
Copy link

I had been struggling with the same error, and I managed to resolve it. My system configuration is as follows:

Windows: 11
Node.js: 18.17.0
npm: 9.6.7
Python: 2.7

Here's what I did to fix the issue:

Installed node-gyp globally:

  • npm install -g node-gyp

Installed a specific version of @tensorflow/tfjs-node to avoid compatibility issues:

  • npm install --save-exact @tensorflow/tfjs-node@3.1.0
    By following these steps, I was able to successfully overcome the error. This might help others who are facing similar issues.

This was referenced Aug 9, 2023
@github-actions
Copy link

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@JijaProGamer
Copy link

Running what @seongho-98 said installs fine, but when running a empty project just with

import * as tf from "@tensorflow/tfjs-node"

it always errors with

node:internal/modules/cjs/loader:1340
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Users\Teapa Gigi\Documents\BrawlStarsAI\node_modules\@tensorflow\tfjs-node\lib\napi-v7\tfjs_binding.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (C:\Users\Teapa Gigi\Documents\BrawlStarsAI\node_modules\@tensorflow\tfjs-node\dist\index.js:60:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.17.1

@gaikwadrahul8
Copy link
Contributor

Hi, @JijaProGamer

Apologize for the delayed response, could you please try below workaround, let us know is it resolving your issue or not ?

Please refer this comment where user was facing the similar issue and below solution worked so I would request you to please give it try from your end once.

D:\TFJS\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll to D:\TFJS\node_modules\@tensorflow\tfjs-node\lib\napi-v7\

If issue still persists please let us know with error log, we'll try to investigate this issue further? Thank you!

@JijaProGamer
Copy link

Hi, @JijaProGamer

Apologize for the delayed response, could you please try below workaround, let us know is it resolving your issue or not ?

Please refer this comment where user was facing the similar issue and below solution worked so I would request you to please give it try from your end once.

D:\TFJS\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll to D:\TFJS\node_modules\@tensorflow\tfjs-node\lib\napi-v7\

If issue still persists please let us know with error log, we'll try to investigate this issue further? Thank you!

Tried it, but still doesnt work. I read that tfjs-node required AVX processors, so that might be the problem.

@digimbyte
Copy link
Author

to clarify:
while it did install, copying;
node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll
to
node_modules\@tensorflow\tfjs-node\lib\napi-v7\
is essential until a real version is supplied

at the moment, I am using a script that copies the dll file on build/run so it is available in my docker image.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@gaikwadrahul8
Copy link
Contributor

Hi, @JijaProGamer

Apologize for the delayed response and Yes, tfjs-node requires AVX processors and tfjs-node library uses AVX instructions to improve the performance of its operations. If your CPU does not support AVX, you will not be able to use tfjs-node if I'm not wrong. Thank you!

@JijaProGamer
Copy link

Hi, @JijaProGamer

Apologize for the delayed response and Yes, tfjs-node requires AVX processors and tfjs-node library uses AVX instructions to improve the performance of its operations. If your CPU does not support AVX, you will not be able to use tfjs-node if I'm not wrong. Thank you!

Will it ever be rewritten better to support non-AVX CPUs? Lower end AMD CPUS and Celeron/Pentium Intel CPUs, along with any ARM CPU have no AVX, making tfjs-node unusable, and tfjs prints a non stoppable warning when trying to use it

@digimbyte
Copy link
Author

digimbyte commented Sep 11, 2023

try the python version?

@Skeli789
Copy link

Something I found to work was renaming the node_modules/@tensorflow/tfjs-node/lib/napi-v8 mid-installation to napi-v9. The tensorflow.dll is then copied correctly and node will work correctly once you sync the files between the napi-v8 and napi-v9 directories.

@saknarak
Copy link

I want to share my success installation with

  • node == 20.11
  • @tensorflow/tfjs-node-gpu == 4.16.0
  1. npm i @tensorflow/tfjs-node
  2. during installing, open another console and run this script to rename napi-v8 to napi-v9 folder
node rename.js
  • rename.js
import fs from 'fs'
// const fs = require('fs')
while (true) {
  try {
    // change tfjs-node-gpu to tfjs-node
    fs.renameSync('./node_modules/@tensorflow/tfjs-node-gpu/lib/napi-v8', './node_modules/@tensorflow/tfjs-node-gpu/lib/napi-v9')
    break
  } catch (e) {

  }
}
console.log('done')
  1. after install success, make sure to move all files in napi-v9 to napi-v8
    node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v8 should have both tensorflow.dll and tfjs_binding.node files

PS: Installation failed because of no target folder napi-v9, but create with mkdir -p node_modules/@tensorflow/tfjs-node-gpu/lib/napi-v9 before npn install is doesn't work, so I have to create during installation instead.

@hludens
Copy link

hludens commented Apr 17, 2024

I have a similar problem

Node.js v20.11.1
npm 10.2.4
@tensorflow/tfjs-node@4.17.0

when running the script it gives an error

Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: D:\develop\nnet\node_serv\node_modules@tensorflow\tfjs-node\lib\napi-v7\tfjs_binding.node.

the rebuild is successful, but the error does not disappear
npm rebuild @tensorflow/tfjs-node --build-addon-from-source
rebuilt dependencies successfully

node_modules@tensorflow\tfjs-node\lib\napi-v7
folder is empty

Perhaps someone can tell me what to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants