简体   繁体   English

错误:html-pdf:在 lambda nodejs 中收到退出代码“127”

[英]Error: html-pdf: Received the exit code '127' in lambda nodejs

I am using "html-pdf" module in my lambda function.我在我的 lambda 函数中使用“html-pdf”模块。 The below is my code下面是我的代码

            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
        });

Code seems to be working fine in local.代码在本地似乎运行良好。 But in lambda I'm getting this error但是在 lambda 中我收到了这个错误

Error: html-pdf: Received the exit code '127' /var/task/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory错误:html-pdf:收到退出代码“127”/var/task/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs:加载共享库时出错:libfontconfig.so.1:无法打开共享对象文件:无此文件或目录

Any ideas ?有任何想法吗 ? Thanks in advance!提前致谢!

For Ubuntu 18.04.5 sudo apt-get install -y libfontconfig sudo apt-get install -y libfreetype6对于 Ubuntu 18.04.5 sudo apt-get install -y libfontconfig sudo apt-get install -y libfreetype6

This works for me.这对我有用。 I got the reference from here https://github.com/ariya/phantomjs/issues/13597我从这里得到了参考https://github.com/ariya/phantomjs/issues/13597

我也有和你一样的BUG,你解决了吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM