我在lambda函数中使用了"html-pdf“模块。下面是我的代码
await pdf.create(html, options).toStream(async function (err, stream) {
if(err) {
return err;
}
let fileName = NAME_OF_FILE;
let key = KEY;
let data = await s3Upload(key, stream) // function to upload to s3
});代码似乎在本地运行得很好。但是在lambda中我得到了这个错误
错误: html-pdf:加载共享库时收到退出代码'127‘/var/task/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs:错误: libfontconfig.so.1:无法打开共享目标文件:没有这样的文件或目录
有什么想法吗?提前感谢!
发布于 2020-11-20 19:03:10
适用于Ubuntu 18.04.5 sudo apt-get install -y libfontconfig sudo apt-get install -y libfreetype6
这对我很有效。我从这里拿到了参考资料https://github.com/ariya/phantomjs/issues/13597
https://stackoverflow.com/questions/64221128
复制相似问题