tfjs: tfjs-node invalid installation/setup no such file or directory
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
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 23 (6 by maintainers)
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 https://github.com/tensorflow/tfjs/issues/7341 where we’ll update once we got the new update from our concerned team with latest version of@tensorflow/tfjs-nodeforWindowsmachine. Thank you!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:I have no idea what this means. The
tfjs_binding.nodeis present in that folder. I tried rebuiling the package locally withnpm 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.dllfile in thatnapi-v7folder.I want to share my success installation with
node== 20.11@tensorflow/tfjs-node-gpu== 4.16.0npm i @tensorflow/tfjs-nodenapi-v8tonapi-v9folderrename.jsnapi-v9tonapi-v8node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v8should have bothtensorflow.dllandtfjs_binding.nodefilesPS: Installation failed because of no target folder
napi-v9, but create withmkdir -p node_modules/@tensorflow/tfjs-node-gpu/lib/napi-v9beforenpn installis doesn’t work, so I have to create during installation instead.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:
Installed a specific version of @tensorflow/tfjs-node to avoid compatibility issues:
Something I found to work was renaming the
node_modules/@tensorflow/tfjs-node/lib/napi-v8mid-installation tonapi-v9. Thetensorflow.dllis then copied correctly and node will work correctly once you sync the files between thenapi-v8andnapi-v9directories.