html-pdf in meteor EPIPE error
Asked Answered
S

2

6

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
Sumo answered 25/3, 2015 at 0:43 Comment(0)
S
8

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.

Sumo answered 25/3, 2015 at 0:43 Comment(0)
G
0

This problem occurs also in Ubuntu v18.04.5

After install the below command it was working fine for me.

sudo apt-get install libfontconfig
Glynis answered 2/4, 2021 at 13:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.