我正在Ubuntu 18.04上开发Rails应用程序。
我使用 wkhtmltopdf-binary-edge、wkhtmltopdf、wkhtmltopdf-binary、wkhtmltopdf-heroku gems 将HTML转换为PDF。
我在Gemfile
中这样定义它:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.0'
gem 'rails', '~> 5.2.1'
gem 'pg'
gem 'puma', '~> 3.11'
gem 'wicked_pdf'
group :development, :test do
gem 'wkhtmltopdf-binary-edge'
end
group :production do
gem 'wkhtmltopdf-heroku'
gem 'wkhtmltopdf-binary'
end
一切正常,直到最近我开始在尝试运行bundle install
时遇到此错误:
错误:正在加载 thewkhtmltopdf-binary-edge gem 中的 wkhtmltopdf可执行文件,但它也存在于其他 gem (wkhtmltopdf-binary( 中。如果要运行另一个 gem 的可执行文件,请确保使用特定于项目的 binstub(bundle binstub(。如果计划使用多个冲突的可执行文件,请为它们生成二进制存根并消除其名称的歧义。
我已经尝试了几种解决方案,但似乎都没有奏效。
这是我如何解决的:
似乎宝石wkhtmltopdf-binary-edge
和wkhtmltopdf-binary
有冲突的可执行文件。
我只需要移除wkhtmltopdf-binary-edge
宝石并以这种方式重新订购Gemfile
:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.0'
gem 'rails', '~> 5.2.1'
gem 'pg'
gem 'puma', '~> 3.11'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
group :production do
gem 'wkhtmltopdf-heroku'
end
就这样。
我希望这有帮助