tpisto/pdf-fill-form

Error: npm install pdf-fill-form - ../src/NodePoppler.cc:18:10: fatal error: 'QMutex' file not found #include <QMutex>

Closed this issue · 6 comments

Issue:
I am building a simple test application pdf-fill-form but cannot get the npm install pdf-fill-form to work

versions:
Node.js v8.10.0 to /usr/local/bin/node
npm@5.7.1 to /usr/local/bin/npm

  • @angular/cli@1.7.3
  • webpack@4.2.0
    Mac High Sierra 10.13.3
    Command Line Tools for Xcode, Version 9.2 (xcode-select version 2349)

Steps to reproduce:

  1. ng new test-pdf-fill-form

cd test-pdf-fill-form

  1. brew:

brew update
brew install qt5 cairo poppler --with-qt5
Warning: qt 5.10.1 is already installed
Warning: cairo 1.14.12 is already installed
Warning: poppler 0.63.0_1 is already installed

  1. I have xcode command line tools installed:

xcode-select version 2349.

  1. I have done the exports:

export LDFLAGS=-L/usr/local/opt/qt5/lib
export CPPFLAGS=-I/usr/local/opt/qt5/include
export PKG_CONFIG_PATH=/usr/local/opt/qt5/lib/pkgconfig

  1. npm install pdf-fill-form
    npm install -save pdf-fill-form

pdf-fill-form@4.0.0 install /Users/nabgilby/Google Drive/Code/Web/test-pdf-fill-form/node_modules/pdf-fill-form
node-gyp rebuild

CXX(target) Release/obj.target/pdf_fill_form/src/pdf-fill-form.o
CXX(target) Release/obj.target/pdf_fill_form/src/NodePopplerAsync.o
CXX(target) Release/obj.target/pdf_fill_form/src/NodePoppler.o
../src/NodePoppler.cc:18:10: fatal error: 'QMutex' file not found
#include
^~~~~~~~
1 error generated.
make: *** [Release/obj.target/pdf_fill_form/src/NodePoppler.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/nabgilby/Google Drive/Code/Web/test-pdf-fill-form/node_modules/pdf-fill-form
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pdf-fill-form@4.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pdf-fill-form@4.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nabgilby/.npm/_logs/2018-03-21T22_04_26_477Z-debug.log

  1. cat /Users/nabgilby/.npm/_logs/2018-03-21T22_04_26_477Z-debug.log
    (ommitted the silly savetree, happy to provide)...
    87 verbose stack Error: pdf-fill-form@4.0.0 install: node-gyp rebuild
    87 verbose stack Exit status 1
    87 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
    87 verbose stack at emitTwo (events.js:126:13)
    87 verbose stack at EventEmitter.emit (events.js:214:7)
    87 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
    87 verbose stack at emitTwo (events.js:126:13)
    87 verbose stack at ChildProcess.emit (events.js:214:7)
    87 verbose stack at maybeClose (internal/child_process.js:925:16)
    87 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    88 verbose pkgid pdf-fill-form@4.0.0
    89 verbose cwd /Users/nabgilby/Google Drive/Code/Web/test-pdf-fill-form
    90 verbose Darwin 17.4.0
    91 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-save" "pdf-fill-form"
    92 verbose node v8.10.0
    93 verbose npm v5.7.1
    94 error code ELIFECYCLE
    95 error errno 1
    96 error pdf-fill-form@4.0.0 install: node-gyp rebuild
    96 error Exit status 1
    97 error Failed at the pdf-fill-form@4.0.0 install script.
    97 error This is probably not a problem with npm. There is likely additional logging output above.
    98 verbose exit [ 1, true ]

Thank you for your consideration.

Seeing the exact same error on npm install. I have the same Mac setup. Co-worker has up and running on Linux just fine. I assume you didn't solve this, @nabgilby?

No, tore my hair out for awhile, reading and trying many things, no go. Would love help.

I ended up switching to HummusJS. It doesn't have the best documentation or seem as simple as pdf-fill-form but I've been able to get it working for my use-case (writing some text on PDFs after tweaking coordinate placements).

Running into the same right now. Has anyone found a workaround yet?

Nope, for my use case, I switched to an online pdf to html5 converter (idrsolutions) which handles forms, checkboxes, drop down menus, then stuck a modified version into my angular 5 web app. A little glitchy but at least it's working so I can present the forms, allow uses to edit and save. Wish we could get an answer to this one though.

To fill forms, I finally settled on pdffiller (https://www.npmjs.com/package/pdffiller) using the java version of PDFTK (https://gitlab.com/marcvinyals/pdftk) under the hood to avoid gcj. I then use Hummus (https://www.npmjs.com/package/hummus) when I need to write text on PDFs and stream via base64 instead of creating PDFs on disk.