rse / node-prince

Node API for executing PrinceXML via prince(1) CLI
https://npmjs.com/prince
49 stars 24 forks source link

Error ENOENT when using in Docker node image #33

Closed elpanas closed 3 years ago

elpanas commented 3 years ago

On local and remotely I use docker and I have this error:

ERROR:  {
2021-01-16T13:18:05.223725+00:00 app[web.1]:   error: Error: spawn /home/app/node_modules/prince/prince/lib/prince/bin/prince ENOENT
2021-01-16T13:18:05.223726+00:00 app[web.1]:       at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
2021-01-16T13:18:05.223727+00:00 app[web.1]:       at onErrorNT (internal/child_process.js:470:16)
2021-01-16T13:18:05.223728+00:00 app[web.1]:       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
2021-01-16T13:18:05.223729+00:00 app[web.1]:     errno: 'ENOENT',
2021-01-16T13:18:05.223730+00:00 app[web.1]:     code: 'ENOENT',
2021-01-16T13:18:05.223730+00:00 app[web.1]:     syscall: 'spawn /home/app/node_modules/prince/prince/lib/prince/bin/prince',
2021-01-16T13:18:05.223731+00:00 app[web.1]:     path: '/home/app/node_modules/prince/prince/lib/prince/bin/prince',
2021-01-16T13:18:05.223731+00:00 app[web.1]:     spawnargs: [...]

Without docker it works locally.

UPDATE: using the latest node version in the dockerfile, I don't have that error anymore but this new one:

/home/app/node_modules/prince/prince/lib/prince/bin/prince: error while loading shared libraries: libgif.so.7: cannot open shared object file: No such file or directory

wezm commented 3 years ago

Sounds like you need to install the libraries Prince depends on. From the README:

NOTICE: PrinceXML provides just distribution-specific and dynamically linked Linux binaries. The Node-Prince installation procedure tries to detect your particular distribution on npm install [-g] prince and downloads the corresponding binary. But because of the dynamic linking of PrinceXML binaries, it still can be that you first have to install some distribution-specific system dependencies. For instance, under Debian 8.0 you first have to install the necessary system packages with apt-get install nodejs nodejs-legacy npm libgif4 curl.

elpanas commented 3 years ago

Sounds like you need to install the libraries Prince depends on. From the README:

NOTICE: PrinceXML provides just distribution-specific and dynamically linked Linux binaries. The Node-Prince installation procedure tries to detect your particular distribution on npm install [-g] prince and downloads the corresponding binary. But because of the dynamic linking of PrinceXML binaries, it still can be that you first have to install some distribution-specific system dependencies. For instance, under Debian 8.0 you first have to install the necessary system packages with apt-get install nodejs nodejs-legacy npm libgif4 curl.

Yeeee. You was right. I installed it by means my dockerfile inside the image and now it works on heroku too.

Here is the codeline for the dockerfile. "Curl" is not necessary but never say never

RUN apt-get update && apt-get -y install curl && apt-get install -y libgif7

Thanks :D