bauhausjs / phantom-html2pdf

Node module to generate PDFs from HTML via PhantomJS
MIT License
112 stars 47 forks source link

Getting error on live server #55

Closed msankar1991 closed 6 years ago

msankar1991 commented 6 years ago

Node version: 6.10.0 npm version: 4.4.1

Getting error centos server for this error

{ Error: Command failed: /var/www/delivery_app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /var/www/delivery_app/node_modules/phantom-html2pdf/lib/phantom-script.js /tmp/tmp-267147QAFKz1Hjrus.html /tmp/tmp-26714AMgpogyzlj9s.pdf   nofile A4 portrait 1cm false false 500
/var/www/delivery_app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

   at ChildProcess.exithandler (child_process.js:198:12)
   at emitTwo (events.js:106:13)
   at ChildProcess.emit (events.js:191:7)
   at maybeClose (internal/child_process.js:920:16)
   at Socket.<anonymous> (internal/child_process.js:351:11)
   at emitOne (events.js:96:13)
   at Socket.emit (events.js:188:7)
   at Pipe._handle.close [as _onclose] (net.js:497:12)
 killed: false,
 code: 127,
 signal: null,
 cmd: '/var/www/delivery_app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /var/www/delivery_app/node_modules/phantom-html2pdf/lib/phantom-script.js /tmp/tmp-267147QAFKz1Hjrus.html /tmp/tmp-26714AMgpogyzlj9s.pdf   nofile A4 portrait 1cm false false 500 ' }
dustin-H commented 6 years ago

Seems like a file of phantomjs is missing.

Have you installed PhantomJS correctly?

msankar1991 commented 6 years ago

Yes its installed correctly. In package.json file also its available

dustin-H commented 6 years ago

After a little Google search for ` it seems like the packagelibfontconfig` is missing at your OS.

Try this: sudo apt-get install libfontconfig.

Some other results: https://github.com/giakki/uncss/issues/165 https://stackoverflow.com/questions/45153363/installing-phantomjs-in-centos https://github.com/ariya/phantomjs/issues/10904 https://stackoverflow.com/questions/45129742/error-while-loading-shared-libraries-libfontconfig-so-1-on-cent-os

This is no issue from phantom-html2pdf.