2017-02-17 102 views
0

在我的Rails环境日志

PDFKit::NoExecutableError (No wkhtmltopdf executable found at `/` is not writable. Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily. /home/ubuntu/rails-app/shared/bundle/ruby/2.3.0/bin/wkhtmltopdfPDFKit :: Ubuntu服务器上NoExecutableError

请安装wkhtmltopdf - https://github.com/pdfkit/PDFKit/wiki/Installing-WKHTMLTOPDF): pdfkit(0.8.2)的lib/pdfkit/pdfkit.rb: 32:在initialize' pdfkit (0.8.2) lib/pdfkit/middleware.rb:21:in新 ' pdfkit(0.8.2)LIB/pdfkit/middleware.rb:21:在`呼叫'

我试过按照说明使用apt-get进行安装,但是错误仍然存​​在。

Ubuntu的服务器@:〜$其中wkhtmltopdf

/home/ubuntu/.rbenv/shims/wkhtmltopdf

Ubuntu的服务器@:〜$ wkhtmltopdf --version

wkhtmltopdf 0.12.3 (with patched qt)

回答

0

你试过

,并创造新file config/initializers/pdfkit.rb

PDFKit.configure do |config| 
    config.wkhtmltopdf = '/home/ubuntu/.rbenv/shims/wkhtmltopdf' 
end 
+0

我怎么知道路径?捆绑显示wkhtmltopdf对不对? config.wkhtmltopdf =“/home/ubuntu/rails-app/shared/bundle/ruby/2.3.0/gems/wkhtmltopdf-binary-0.12.3.1” 仍然无法正常工作 – olleh

+0

我用基于wkhtmltopdf路径关于'根目录上的哪个wkhtmltopdf' 然后这个错误出现了 '''RuntimeError(command failed(exitstatus = 1):/ usr/bin/wkhtmltopdf --quiet --page-size Letter --margin-顶部0.75in - 右边缘0.75in - 边缘底部0.75in - 边缘 - 左边0.75in - 编码UTF-8 --print-media-type - - ): pdfkit(0.8.2)lib/pdfkit/pdfkit.rb:71:在'to_pdf''''中 – olleh

+0

这看起来像https://github.com/pdfkit/pdfkit/issues/234 –