【问题标题】:Rails: wkhtmltopdf executable in the wkhtmltopdf-binary-edge gem is being loadedRails:正在加载 wkhtmltopdf-binary-edge gem 中的 wkhtmltopdf 可执行文件
【发布时间】:2020-05-15 09:07:28
【问题描述】:

我正在 Ubuntu 18.04 上开发 Rails 应用程序。

我使用wkhtmltopdf-binary-edgewkhtmltopdfwkhtmltopdf-binarywkhtmltopdf-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 时开始遇到此错误时,一切正常:

错误:wkhtmltopdf-binary-edge gem 中的 wkhtmltopdfexecutable 正在加载,但它也存在于其他 gem (wkhtmltopdf-binary) 中。如果您打算为另一个 gem 运行可执行文件,请确保使用项目特定的 binstub (bundle binstub)。如果您计划使用多个冲突的可执行文件,请为它们生成 binstub 并消除它们的名称歧义。

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

【问题讨论】:

    标签: ruby-on-rails ruby rubygems wkhtmltopdf


    【解决方案1】:

    我是这样解决的

    似乎 gem 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 
    

    就是这样。

    我希望这会有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      • 2017-07-14
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      相关资源
      最近更新 更多