tldr-pages / tldr-node-client

Node.js command-line client for tldr pages 📚
https://www.npmjs.com/package/tldr
MIT License
439 stars 72 forks source link

TLDR update error #445

Open shev85 opened 1 month ago

shev85 commented 1 month ago

tldr --update ⠧ Updating.../usr/local/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62 throw Utils.Errors.INVALID_FILENAME(); ^

Error: ADM-ZIP: Invalid filename at Object.INVALID_FILENAME (/usr/local/lib/node_modules/tldr/node_modules/adm-zip/util/errors.js:56:16) at new module.exports (/usr/local/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62:32) at WriteStream. (/usr/local/lib/node_modules/tldr/lib/remote.js:32:21) at WriteStream.emit (node:events:529:35) at finish (node:internal/streams/writable:748:10) at finishMaybe (node:internal/streams/writable:733:9) at afterWrite (node:internal/streams/writable:507:3) at onwrite (node:internal/streams/writable:480:7) at node:internal/fs/streams:465:5 at node:internal/fs/streams:421:7

Node.js v18.19.1

on ubuntu 24.04,dosen’t work,how to fix it?

kbdharun commented 1 month ago

Thanks for reporting the issue, can you try running tldr --clear-cache then run tldr --update to see if it fixes the issue?

ycyin commented 1 month ago

@kbdharun Hi! I used nvm to switch node versions 18, 20, 22 and none of them worked. Trying to use tldr --clear-cache and then tldr --update is the same issue.

[ttt@Ubuntu24.04 ~ (⎈|default]$ tldr --update
⠼ Updating.../home/ttt/.nvm/versions/node/v22.9.0/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62
            throw Utils.Errors.INVALID_FILENAME();
            ^

Error: ADM-ZIP: Invalid filename
    at Object.INVALID_FILENAME (/home/ttt/.nvm/versions/node/v22.9.0/lib/node_modules/tldr/node_modules/adm-zip/util/errors.js:56:16)
    at new module.exports (/home/ttt/.nvm/versions/node/v22.9.0/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62:32)
    at WriteStream.<anonymous> (/home/ttt/.nvm/versions/node/v22.9.0/lib/node_modules/tldr/lib/remote.js:32:21)
    at WriteStream.emit (node:events:531:35)
    at finish (node:internal/streams/writable:955:10)
    at node:internal/streams/writable:936:13
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Node.js v22.9.0
agnivade commented 1 month ago

I am unable to repro this. Using Node 20.11.1.

shev85 commented 1 month ago

Thanks for reporting the issue, can you try running tldr --clear-cache then run tldr --update to see if it fixes the issue?

Try tldr --clear-cache then run tldr --update , dosen't work,either.

kbdharun commented 1 month ago

Hi, Can you try running npm uninstall -g tldr then remove cache with npm cache clean --force then reinstall it using npm install -g tldr to see if it fixes the issue.

LeDavid commented 1 month ago

It seems that I have the same problem after a fresh install:

Updating.../usr/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62 throw Utils.Errors.INVALID_FILENAME(); ^

Error: ADM-ZIP: Invalid filename at Object.INVALID_FILENAME (/usr/lib/node_modules/tldr/node_modules/adm-zip/util/errors.js:56:16) at new module.exports (/usr/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62:32) at WriteStream. (/usr/lib/node_modules/tldr/lib/remote.js:32:21) at WriteStream.emit (node:events:531:35) at finish (node:internal/streams/writable:953:10) at node:internal/streams/writable:934:13 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v20.18.0

I have tried all the solutions proposed above (uninstall, clear cache, etc.) but none of them solved the problem.

kbdharun commented 1 month ago

It seems that I have the same problem after a fresh install:

Updating.../usr/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62 throw Utils.Errors.INVALID_FILENAME(); ^

Error: ADM-ZIP: Invalid filename at Object.INVALID_FILENAME (/usr/lib/node_modules/tldr/node_modules/adm-zip/util/errors.js:56:16) at new module.exports (/usr/lib/node_modules/tldr/node_modules/adm-zip/adm-zip.js:62:32) at WriteStream. (/usr/lib/node_modules/tldr/lib/remote.js:32:21) at WriteStream.emit (node:events:531:35) at finish (node:internal/streams/writable:953:10) at node:internal/streams/writable:934:13 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v20.18.0

I have tried all the solutions proposed above (uninstall, clear cache, etc.) but none of them solved the problem.

Hi, if possible can you clone the repository here with git clone https://github.com/tldr-pages/tldr-node-client && cd tldr-node-client then install the dependencies with npm install then try ./bin/tldr --update to see if it fixes the issue and let me know.

If the issue is due to outdated dependencies, then it will be fixed when I make a new release with the updated deps from the main branch.

LeDavid commented 1 month ago

I did what you wrote and I got this error message:

Updating.../home/david/Tmp/tldr-node-client/node_modules/adm-zip/zipFile.js:123
        if (endOffset == -1) throw Utils.Errors.INVALID_FORMAT();
                             ^

Error: ADM-ZIP: Invalid or unsupported zip format. No END header found
    at Object.INVALID_FORMAT (/home/david/Tmp/tldr-node-client/node_modules/adm-zip/util/errors.js:56:16)
    at readMainHeader (/home/david/Tmp/tldr-node-client/node_modules/adm-zip/zipFile.js:123:49)
    at new module.exports (/home/david/Tmp/tldr-node-client/node_modules/adm-zip/zipFile.js:21:9)
    at new module.exports (/home/david/Tmp/tldr-node-client/node_modules/adm-zip/adm-zip.js:67:18)
    at WriteStream.<anonymous> (/home/david/Tmp/tldr-node-client/lib/remote.js:32:21)
    at WriteStream.emit (node:events:531:35)
    at finish (node:internal/streams/writable:953:10)
    at node:internal/streams/writable:934:13
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v20.18.0

I hope this would help you to find what happens.