Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html-pdf in meteor EPIPE error

I have a Meteor app that renders a PDF server-side using html-pdf. The app is deployed with mup. Locally, everything works fine. Upon deployment, I see this error in the server logs:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE
    at errnoException (net.js:905:11)
    at Object.afterWrite (net.js:721:19)
error: Forever detected script exited with code: 8
error: Script restart attempt #1

Versions of stuff:

  • Ubuntu 14.04.2 LTS
  • Meteor 1.0.4.2
  • Node.js 0.10.37
  • mup 0.9.7
like image 534
Adam Monsen Avatar asked Mar 25 '15 00:03

Adam Monsen


1 Answers

Summary

The fix: sudo apt-get install libfontconfig

Details

I noticed that html-pdf depends on and installs phantomjs itself. I found a couple of compiled phantomjs binaries:

/opt/testapp/app/programs/server/npm/testpackage/node_modules/html-pdf/node_modules/phantomjs/bin/phantomjs
/opt/testapp/app/programs/server/npm/testpackage/node_modules/html-pdf/node_modules/phantomjs/lib/phantom/bin/phantomjs

When I tried to run either binary directly, I got this error:

error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

A web search turned up this secret dependency.

like image 148
Adam Monsen Avatar answered Oct 22 '22 22:10

Adam Monsen