Rails: 正在加载 wkhtmltopdf-binary-edge gem 中的 wkhtmltopdf 可执行文件

Rails: wkhtmltopdf executable in the wkhtmltopdf-binary-edge gem is being loaded

我正在 Rails 申请 Ubuntu 18.04.

我使用 wkhtmltopdf-binary-edge, wkhtmltopdf, wkhtmltopdf-binary, wkhtmltopdf-heroku gem 将 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:

时开始遇到此错误

Error: The wkhtmltopdfexecutable in thewkhtmltopdf-binary-edge gem is being loaded, but it's also present in other gems (wkhtmltopdf-binary). If you meant to run the executable for another gem, make sure you use a project specific binstub (bundle binstub ). If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names.

我尝试了几个解决方案,但 none 似乎有效。

我是这样解决的:

似乎 gems wkhtmltopdf-binary-edgewkhtmltopdf-binary 有冲突的可执行文件。

我只需要删除 wkhtmltopdf-binary-edge gem 并重新排序 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 

就这些了。

希望对您有所帮助