marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 543 forks source link

not working on live server #602

Open menarayanzshrestha opened 3 years ago

menarayanzshrestha commented 3 years ago

everything works fine on local server ..... but when i deploy it in AWS server using docker .I respond be this error.

Error: write EPIPE

at afterWriteDispatched (internal/stream_base_commons.js:150:25)

at writeGeneric (internal/stream_base_commons.js:141:3)

at Socket._writeGeneric (net.js:771:11)

at Socket._write (net.js:783:8)

at doWrite (_stream_writable.js:431:12)

at writeOrBuffer (_stream_writable.js:415:5)

at Socket.Writable.write (_stream_writable.js:305:11)

at PDF.PdfExec [as exec] (/usr/src/app/node_modules/html-pdf/lib/pdf.js:141:15)

at PDF.PdfToFile [as toFile] (/usr/src/app/node_modules/html-pdf/lib/pdf.js:83:8)

at /usr/src/app/dist/modules/merchant/merchantprofile.service.js:1021:22 {

errno: 'EPIPE',

code: 'EPIPE',

syscall: 'write'

}

Error: spawn /usr/src/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT

at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)

at onErrorNT (internal/child_process.js:456:16)

at processTicksAndRejections (internal/process/task_queues.js:80:21) {

errno: 'ENOENT',

code: 'ENOENT',

syscall: 'spawn /usr/src/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',

path: '/usr/src/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',

spawnargs: [

'/usr/src/app/node_modules/html-pdf/lib/scripts/pdf_a4_portrait.js'

]

}

(node:18) UnhandledPromiseRejectionWarning: Error: spawn /usr/src/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT

at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)

at onErrorNT (internal/child_process.js:456:16)

at processTicksAndRejections (internal/process/task_queues.js:80:21)

(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

radzk commented 3 years ago

just started to getting the same error, @menarayanzshrestha any progress?

menarayanzshrestha commented 3 years ago

@radzk . Check this: https://stackoverflow.com/questions/37363317/pdf-file-creation-using-html-pdf-is-not-working-in-my-deployment-server

MaurerKrisztian commented 2 years ago

@radzk @menarayanzshrestha I had the same problem but I found some solution: If I understand correctly the problem is this package need fonts and try to reach phantomJs but not exist in the environment https://github.com/marcbachmann/node-html-pdf/issues/612#issuecomment-798835694 https://github.com/marcbachmann/node-html-pdf/issues/612#issuecomment-854249720 https://github.com/marcbachmann/node-html-pdf/issues/35#issuecomment-155144094