安装wkhtmtopdf-heroku时出错

时间:2022-04-11 00:24:59

Heroku doesn't allow me to put airbrake and wkhtmlpdf-heroku gems together. My previous push works fine without airbrake. If I put airbrake again in my gemfile, the error below results:

Heroku不允许我将airbrake和wkhtmlpdf-heroku宝石放在一起。没有空气制动器,我之前的推动工作正常。如果我再次将airbrake放入我的gemfile中,则会出现以下错误:

Bundler::GemspecError: Could not read gem at /tmp/build_li34yprz7arq/vendor/bundle/ruby/1.9.1/cache/wkhtmltopdf-heroku-1.0.0.gem. It may be corrupted.
   An error occurred while installing wkhtmltopdf-heroku (1.0.0), and Bundler
   cannot continue.

Do you know any reason why that's happening? Thanks!

你知道为什么会这样吗?谢谢!

1 个解决方案

#1


0  

The wkhtmltopdf-heroku gem just drops a wkhtmltopdf binary in your project and sets up configs for common 'client' gems. You can just do that yourself manually. I say this because I had some other odd issues tied to that gem that went away mysteriously when I just did setup for myself.

wkhtmltopdf-heroku gem只会在你的项目中删除一个wkhtmltopdf二进制文件,并为常见的“客户端”宝石设置配置。你可以自己手动完成。我之所以这么说,是因为当我为自己设置时,我还有一些其他奇怪的问题与神奇地消失了。

So try just dropping wkhtmltopdf-amd64 in your projects bin directory and do your own config. In my case, for wicked_pdf, that meant a wicked_pdf.rb in /initializers containing

因此,尝试在项目bin目录中删除wkhtmltopdf-amd64并执行自己的配置。就我而言,对于wicked_pdf,这意味着/ initializers中的wicked_pdf.rb包含

WickedPdf.config = { :exe_path => (Rails.env.test? || Rails.env.development? ? 'c:\Program Files\wkhtmltopdf\wkhtmltopdf.exe' : Rails.root.join('bin', 'wkhtmltopdf-amd64').to_s),
                 :page_size => 'Letter',
                 :outline => {:outline => true, :outline_depth => 4}}

Just to clarify, that is pointing to a windows binary on my C drive for test and production, and otherwise (meaning production) pointing to the amd-64 binary (for Heroku) which I have in the project's bin directory.

只是为了澄清,这是指向我的C驱动器上用于测试和生产的Windows二进制文件,以及指向我在项目的bin目录中的amd-64二进制文件(用于Heroku)的其他(意味着生产)。

#1


0  

The wkhtmltopdf-heroku gem just drops a wkhtmltopdf binary in your project and sets up configs for common 'client' gems. You can just do that yourself manually. I say this because I had some other odd issues tied to that gem that went away mysteriously when I just did setup for myself.

wkhtmltopdf-heroku gem只会在你的项目中删除一个wkhtmltopdf二进制文件,并为常见的“客户端”宝石设置配置。你可以自己手动完成。我之所以这么说,是因为当我为自己设置时,我还有一些其他奇怪的问题与神奇地消失了。

So try just dropping wkhtmltopdf-amd64 in your projects bin directory and do your own config. In my case, for wicked_pdf, that meant a wicked_pdf.rb in /initializers containing

因此,尝试在项目bin目录中删除wkhtmltopdf-amd64并执行自己的配置。就我而言,对于wicked_pdf,这意味着/ initializers中的wicked_pdf.rb包含

WickedPdf.config = { :exe_path => (Rails.env.test? || Rails.env.development? ? 'c:\Program Files\wkhtmltopdf\wkhtmltopdf.exe' : Rails.root.join('bin', 'wkhtmltopdf-amd64').to_s),
                 :page_size => 'Letter',
                 :outline => {:outline => true, :outline_depth => 4}}

Just to clarify, that is pointing to a windows binary on my C drive for test and production, and otherwise (meaning production) pointing to the amd-64 binary (for Heroku) which I have in the project's bin directory.

只是为了澄清,这是指向我的C驱动器上用于测试和生产的Windows二进制文件,以及指向我在项目的bin目录中的amd-64二进制文件(用于Heroku)的其他(意味着生产)。