tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.51k stars 1.93k forks source link

ADM-ZIP Error #8427

Open vision66 opened 3 weeks ago

vision66 commented 3 weeks ago

entry an empty directory, then run in 'Git Bash'

npm init -y
TFJS_NODE_CDN_STORAGE="https://npmmirror.com/mirrors/" npm install @tensorflow/tfjs-node --verbose

get result:

351 verbose Windows_NT 10.0.22631
352 verbose node v18.20.4
353 verbose npm  v10.7.0
354 error code 1
355 error path D:\nodejs\usecase\tensorflow.js\node_modules\@tensorflow\tfjs-node
356 error command failed
357 error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/install.js
358 error CPU-windows-4.22.0.zip
358 error https://npmmirror.com/mirrors/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
359 error * Downloading libtensorflow
359 error
359 error D:\nodejs\usecase\tensorflow.js\node_modules\adm-zip\util\errors.js:56
359 error         return new Error('ADM-ZIP: ' + message);
359 error                ^
359 error
359 error Error: ADM-ZIP: Invalid or unsupported zip format. No END header found
359 error     at Object.INVALID_FORMAT (D:\nodejs\usecase\tensorflow.js\node_modules\adm-zip\util\errors.js:56:16)
359 error     at readMainHeader (D:\nodejs\usecase\tensorflow.js\node_modules\adm-zip\zipFile.js:123:49)
359 error     at new module.exports (D:\nodejs\usecase\tensorflow.js\node_modules\adm-zip\zipFile.js:21:9)
359 error     at new module.exports (D:\nodejs\usecase\tensorflow.js\node_modules\adm-zip\adm-zip.js:67:18)
359 error     at WriteStream.<anonymous> (D:\nodejs\usecase\tensorflow.js\node_modules\@tensorflow\tfjs-node\scripts\resources.js:72:29)
359 error     at WriteStream.emit (node:events:517:28)
359 error     at emitCloseNT (node:internal/streams/destroy:132:10)
359 error     at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
359 error
359 error Node.js v18.20.4
360 verbose exit 1
361 verbose code 1

test adm-zip, its ok

const zip = require('adm-zip');

const tempFileName = `temp/libtensorflow-cpu-windows-x86_64-2.9.1.zip`
const destPath = `temp/libtensorflow`
const zipFile = new zip(tempFileName);
zipFile.extractAllTo(destPath, true /* overwrite */);

This error should not be related to Python, perhaps it was caused by incomplete download using httpClient in resource.js

shmishra99 commented 3 weeks ago

HI @vision66 ,

I am able to run the command you have mentioned in my macOS without any issue. Your provided command is generating the package.json file and downloading the @tensorflow/tfjs-node package. Let me know if I am missing anything.

Thank you!

github-actions[bot] commented 2 weeks ago

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.

vision66 commented 2 weeks ago

HI @vision66 ,

I am able to run the command you have mentioned in my macOS without any issue. Your provided command is generating the package.json file and downloading the @tensorflow/tfjs-node package. Let me know if I am missing anything.

Thank you!

I also tested it on macos to install correctly, so it looks like this is happening in Windows