在生产中使用wkhtmltopdf时出现无效平台错误

问题描述 投票:0回答:1

我已经部署了一个使用 wicked-pdf 生成 PDF 的应用程序,但我无法让它工作。我的服务器使用 ubuntu-20.04,下面是我收到的错误(我使用 ruby:2.7.1-alpine)

/usr/local/bundle/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf:69:in `<main>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, CentOS 6/7/8, Debian 9/10, Archlinux amd64, or Intel-based Cocoa macOS (missing binary: /usr/local/bundle/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_alpine_3.12.0_amd64). (RuntimeError)
ruby-on-rails ruby wkhtmltopdf alpine-linux wicked-pdf
1个回答
0
投票

通过将以下行添加到 dockerfile 来修复它:

RUN apk --no-cache add wkhtmltopdf ttf-ubuntu-font-family

正在更新

config/initializers/wicked_pdf.rb

require "wicked_pdf"

WickedPdf.config = {
  exe_path: '/usr/bin/wkhtmltopdf'
}
© www.soinside.com 2019 - 2024. All rights reserved.