Open RobKohr opened 2 years ago
@RobKohr
I figured out a workaround. In short, replace the outdated bin pdftocairo of x86_64 arch (not working for M1) with M1's.
rm /Users/robertkohr/projects/bingo-pdfkit/node_modules/pdf-poppler/lib/osx/poppler-0.66/bin/pdftocairo
ln -s -f /opt/homebrew/bin/pdftocairo /Users/robertkohr/projects/bingo-pdfkit/node_modules/pdf-poppler/lib/osx/poppler-0.66/bin/pdftocairo
If this does not work, please check if the paths are correct. Or maybe you just haven't installed poppler for M1, which means /opt/homebrew/bin/pdftocairo
does not exist.
IMO: the long-term solution should be making a PR to dynamically pick the right pdftocairo
for different runtime env (arm vs x86), so that we don't need to do the workaround every time we npm install pdf-poppler
on M1. However, I'm afraid the author doesn't maintain the package anymore (since there's no update since 4 years ago)?
brew install cairo
won't fix the issue, because it installed M1-based lib to /opt/homebrew/lib/libcairo.2.dylib
which is not compatible with x86_64-based pdftocairo
. Even you point the lib with a soft link, it would show an runtime error (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')
.
This is still happening after running
brew install cairo
: