Node Js PDF Phantom ENOENT



我有一个node js服务器,从html正文生成pdf -没有问题,安装在我的PC (Windows)本地,但当我安装在远程服务器(Linux)得到这个错误:

App 3111574输出:{错误:spawn/home/smorenoc/public_html/Casos/node_modules/phantomjs-prebuilt/lib/phantombinphantomjs.exeApp 3111574输出:在Process.ChildProcess._handle。onexit(内部/child_process.js: 240:19)App 3111574输出:at onErrorNT (internal/child_process.js:415:16)应用程序3111574输出:在过程中。_tickCallback(内部/过程/next_tick.js 63:19):App 3111574输出:errno: 'ENOENT',App 3111574输出:代码:'ENOENT',App 3111574输出:App 3111574输出:'spawn/home/smorenoc/public_html/Casos/node_modules/phantomjs-prebuilt/lib/phantombinphantomjs.exe',App 3111574输出:路径:App 3111574输出:'/home/smoreenc/public_html/Casos/node_modules/phantomjs-prebuilt/lib/phantombinphantomjs.exe',App 3111574输出:产卵:App 3111574输出:['/home/smoreenc/public_html/Casos/node_modules/html-pdf/lib/scripts/pdf_a4_port .js']}

/public_html/Casos/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs.exe实际上存在于服务器中,但似乎没有找到它

我无法访问服务器上的终端,我正在通过cpanel安装。

Thanks in advance

Please add the scripts to the Dockerfile:
RUN apk add fontconfig ttf-dejavu
RUN apk add --no-cache curl &&
cd /tmp && curl -Ls https://github.com/dustinblackman/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz | tar xz &&
cp -R lib lib64 / &&
cp -R usr/lib/x86_64-linux-gnu /usr/lib &&
cp -R usr/share /usr/share &&
cp -R etc/fonts /etc &&
apk del curl
I did it and it works well. (node:12.20-alpine3.12)

最新更新