2017-02-17 111 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 –