问题描述
尝试在节点应用程序中使用html-pdf
软件包时出现一致错误:
I'm getting a consistent error when trying to use the html-pdf
package in my node application:
StatusError: Error: spawn /home/site/wwwroot/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT
据我所知,一切均已正确安装,并且npm install
可以正常工作.我怀疑内置的Linux映像中缺少一些依赖项,但是我不确定如何确认.
As far as I can tell everything is installed correctly and the npm install
works as expected. My suspicion is that there is some missing dependency in the built-in linux image, but I'm not sure how to confirm that.
推荐答案
According to the information comes from the Download PhantomJS
page, there is two note for Linux Distributions as below.
因此,本机软件包fontconfig
或libfontconfig
必须首先安装在Docker映像中.
So the native package fontconfig
or libfontconfig
must have been installed in docker image first.
对于Debian/Ubuntu系统,您可以在docker文件中添加RUN apt install fontconfig
,并通过命令dpkg -l|grep fontconfig
检查安装的软件包是否存在.
For Debian/Ubuntu system, you can add RUN apt install fontconfig
in the docker file, and check the package installed whether be exists via the command dpkg -l|grep fontconfig
.
对于Fedora/CentOS系统,添加RUN yum install -y fontconfig
,然后通过yum list installed|grep fontconfig
检查安装情况.
For Fedora/CentOS system, add RUN yum install -y fontconfig
, and check the installed on via yum list installed|grep fontconfig
.
这篇关于我可以在适用于Linux的Azure应用服务上使用phantomJS吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!