Next.js Discord

Discord Forum

Running npm binary dependencies?

Unanswered
American Shorthair posted this in #help-forum
Open in Discord
American ShorthairOP
I've gone down a rabbit hole of trying to run pdflatex (a.k.a, pdfex) via the node-latex NPM package. I have a shell script that installs the appropriate packages via vercel.json which includes this line:

"installCommand": "sh ./packages.sh && npm install"

package.sh includes some diagnostics:

cd /; find . -name pdflatex 2>/dev/null
ls -l /usr/bin/pdflatex 2>/dev/null
ls -l /usr/bin/pdftex 2>/dev/null


which return:

./usr/bin/pdflatex
lrwxrwxrwx 1 root root 6 Dec  5 21:31 /usr/bin/pdflatex -> pdftex
-rwxr-xr-x 1 root root 716256 Jul  2  2020 /usr/bin/pdftex
lrwxrwxrwx 1 root root 6 Dec  5 21:31 /usr/bin/pdflatex -> pdftex
-rwxrwxrwx 1 root root 716256 Jul  2  2020 /usr/bin/pdftex


In the build logs after the package installations complete

However, when I attempt to call the PDF library via server code, I get the following error:

Uncaught Exception     {"errorType":"Error","errorMessage":"Error: Unable to run /usr/bin/pdftex command.","stack":["Error: Error: Unable to run /usr/bin/pdftex command.","    at ChildProcess.<anonymous> (/var/task/.next/server/app/pdf/resume/[id]/route.js:9:953)","    at ChildProcess.emit (node:events:517:28)","    at ChildProcess._handle.onexit (node:internal/child_process:290:12)","    at onErrorNT (node:internal/child_process:477:16)","    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"]}


Clearly the binary file is loaded during the build and has the correct permissions. Is there something else necessary for executing binary dependencies or is this a Vercel bug?

0 Replies