Open
Description
Issue or Feature
- If this is an issue with installation, I have read the troubleshooting guide.
I can't build an Electron app as soon as I install pdfjs-dist
(and by extension canvas
). I'm not even importing nor using pdfjs-dist
. The app can't compile and crashes immediately.
I have installed all the necessary packages with brew
: pkg-config
, cairo
, pango
, libpng
, jpeg
, giflib
, librsvg
, libffi
.
The error is:
> electron-forge start
✔ Checking your system
✔ Locating application
✔ Loading configuration
✖ Preparing native dependencies: 0 / 1
› node-gyp failed to rebuild '/Users/myname/Desktop/myapp/node_modules/canvas'
◼ Running generateAssets hook
› Package 'gobject-2.0' requires 'libffi >= 3.0.0' but version of libffi is 2.1
SOLINK_MODULE(target) Release/canvas-postbuild.node
CXX(target) Release/obj.target/canvas/src/backend/Backend.o
In file included from ../src/backend/Backend.cc:1:
../src/backend/Backend.h:60:14: warning: private field 'backend' is not used
Backend* backend;
^
1 warning generated.
CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
In file included from ../src/backend/PdfBackend.cc:1:
In file included from ../src/backend/PdfBackend.h:4:
In file included from ../src/backend/../closure.h:5:
../src/backend/../Canvas.h:9:10: fatal error: 'pango/pangocairo.h' file not…
#include <pango/pangocairo.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/canvas/src/backend/PdfBackend.o] Error 1
Error: `make` failed with exit code: 2
at ChildProcess.onExit (/Users/myname/Desktop/myapp/node_modu…
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
An unhandled rejection has occurred inside Forge:
Error: node-gyp failed to rebuild '/Users/myname/Desktop/myapp/node_modules/canvas'
at ChildProcess.<anonymous> (/Users/myname/Desktop/myapp/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js:118:24)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Environment
- Version of node-canvas (output of
npm list canvas
): - └─┬ [email protected]
└── [email protected] - Environment
- node 18.16.1 on Mac OS X 13.4.1 Ventura, Intel 7, no M1/M2)
I have opened an issue on pdfjs's repository.