我正在使用库html-pdf来渲染pdf,然后用电子邮件发送文件。它在localhost上的工作就像一个魅力
pdf.create(html, {format: 'A4'}).toFile(`./public/invoices/${order.id}.pdf`, (err, res) => {
if (err) return console.log(err);
});
目前我在Heroku上托管节点。在执行pdf.create()之前,它工作正常。得到以下错误:
2022-08-25T21:32:13.925568+00:00 app[web.1]: Auto configuration failed
2022-08-25T21:32:13.925570+00:00 app[web.1]: 139861897091008:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libproviders.so): libproviders.so: cannot open shared object file: No such file or directory
2022-08-25T21:32:13.925571+00:00 app[web.1]: 139861897091008:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
2022-08-25T21:32:13.925572+00:00 app[web.1]: 139861897091008:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=providers, path=providers
2022-08-25T21:32:13.925573+00:00 app[web.1]: 139861897091008:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=providers
2022-08-25T21:32:13.925574+00:00 app[web.1]:
2022-08-25T21:32:13.925575+00:00 app[web.1]: at ChildProcess.respond (/app/node_modules/html-pdf/lib/pdf.js:134:17)
2022-08-25T21:32:13.925576+00:00 app[web.1]: at ChildProcess.emit (node:events:513:28)
2022-08-25T21:32:13.925576+00:00 app[web.1]: at ChildProcess.emit (node:domain:489:12)
2022-08-25T21:32:13.925577+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
我认为问题出在一些html-pdf依赖项上,比如phantomjs。如果有人能帮助我,或者有人知道更好的html-pdf解决方案,我会很高兴。
1条答案
按热度按时间kpbpu0081#
我找到了解决办法
如果还有人想知道,就加上
到选项。
它看起来像这样