shebinleo / pdf2html

pdf2html is a module which helps to convert PDF file to HTML pages using Apache Tika. This module also helps to generate thumbnail image for PDF file using Apache PDFBox.
https://www.npmjs.com/package/pdf2html
Apache License 2.0
153 stars 32 forks source link

Error: Failed downloading dependency tika-app-2.6.0.jar #60

Open SBerda opened 6 months ago

SBerda commented 6 months ago

Hi, I'm getting this error : .../pdf2html@3.1.0/node_modules/pdf2html postinstall: throw new Error(Failed downloading dependency ${filename}.); .../pdf2html@3.1.0/node_modules/pdf2html postinstall: ^ .../pdf2html@3.1.0/node_modules/pdf2html postinstall: Error: Failed downloading dependency tika-app-2.6.0.jar. .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at ClientRequest.<anonymous> (/builds/infrastructure/applications_slack/patchs_data/millenium/node_modules/.pnpm/pdf2html@3.1.0/node_modules/pdf2html/postinstall.js:27:23) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at ClientRequest.emit (node:events:518:28) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at TLSSocket.socketErrorListener (node:_http_client:495:9) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at TLSSocket.emit (node:events:518:28) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at emitErrorNT (node:internal/streams/destroy:169:8) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at emitErrorCloseNT (node:internal/streams/destroy:128:3) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: at process.processTicksAndRejections (node:internal/process/task_queues:82:21) .../pdf2html@3.1.0/node_modules/pdf2html postinstall: Node.js v20.11.0 .../pdf2html@3.1.0/node_modules/pdf2html postinstall: Failed Anyone having the same ? Thank you

toknT commented 4 months ago

Are you a server in China mainland? Finally I build it locally and upload to the server.

shebinleo commented 4 months ago

You can download the dependencies manually following this guide https://github.com/shebinleo/pdf2html?tab=readme-ov-file#manually-download-dependencies-files

toknT commented 3 months ago

@shebinleo unfortunately, in some environment the postinstall.js failed and will not create node_modules

ubuntu@VM-0-17-ubuntu ~/t/test-project (master) [126]> npm install
npm WARN deprecated @types/graphql-relay@0.7.0: This is a stub types definition. graphql-relay provides its own type definitions, so you do not need this installed.
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm WARN deprecated gauge@3.0.2: This package is no longer supported.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated @apollo/server-plugin-landing-page-graphql-playground@4.0.0: The use of GraphQL Playground in Apollo Server was supported in previous versions, but this is no longer the case as of December 31, 2022. This package exists for v4 migration purposes only. We do not intend to resolve security issues or other bugs with this package if they arise, so please migrate away from this to [Apollo Server's default Explorer](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages) as soon as possible.
npm WARN deprecated fstream@1.0.12: This package is no longer supported.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated superagent@8.1.2: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net
npm WARN deprecated subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm ERR! code 1
npm ERR! path /home/ubuntu/tmp/test-project/node_modules/pdf2html
npm ERR! command failed
npm ERR! command sh -c node postinstall.js
npm ERR! Started downloading dependency pdfbox-app-2.0.27.jar.
npm ERR! Started downloading dependency tika-app-2.6.0.jar.
npm ERR! /home/ubuntu/tmp/test-project/node_modules/pdf2html/postinstall.js:27
npm ERR!                 throw new Error(`Failed downloading dependency ${filename}.`);
npm ERR!                 ^
npm ERR!
npm ERR! Error: Failed downloading dependency pdfbox-app-2.0.27.jar.
npm ERR!     at ClientRequest.<anonymous> (/home/ubuntu/tmp/test-project/node_modules/pdf2html/postinstall.js:27:23)
npm ERR!     at ClientRequest.emit (node:events:514:28)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:495:9)
npm ERR!     at TLSSocket.emit (node:events:514:28)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR!     at runNextTicks (node:internal/process/task_queues:64:3)
npm ERR!     at listOnTimeout (node:internal/timers:540:9)
npm ERR!     at process.processTimers (node:internal/timers:514:7)
npm ERR!
npm ERR! Node.js v20.10.0

npm ERR! A complete log of this run can be found in: /home/ubuntu/.npm/_logs/2024-05-24T03_51_21_406Z-debug-0.log
ubuntu@VM-0-17-ubuntu ~/t/test-project (master) [1]> cd node_modules/pdf2html/vendor
cd: The directory “node_modules/pdf2html/vendor” does not exist
ubuntu@VM-0-17-ubuntu ~/t/test-project (master) [1]>                          

maybe you should remove throw new Error in postinstall.js and write

npm install --save pdf2html
cd node_modules/pdf2html/vendor
wget https://archive.apache.org/dist/pdfbox/2.0.27/pdfbox-app-2.0.27.jar
wget https://archive.apache.org/dist/tika/2.6.0/tika-app-2.6.0.jar

in README