wicked_pdf icon indicating copy to clipboard operation
wicked_pdf copied to clipboard

Command Error: The `wkhtmltopdf` executable in the `wkhtmltopdf-binary-edge` gem is being loaded, but it's also present in other gems (wkhtmltopdf-binary)

Open RubenGram opened this issue 4 years ago • 4 comments

Issue description

The next problem ocurred when I was trying to create a pdf: "The wkhtmltopdf executable in the wkhtmltopdf-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 <gem_name>)"

Are both wkhtmltopdf-binary-edge and wkhtmltopdf-binary gems necessary?

Error: Failed to execute: ["/.rbenv/versions/2.3.6/bin/wkhtmltopdf", "-q", "--encoding", "UTF-8", "file:///var/folders/ds/70lrh2194yb9jnwgzx28vm100000gn/T/wicked_pdf20200423-33047-47tsw2.html", "/var/folders/ds/70lrh2194yb9jnwgzx28vm100000gn/T/wicked_pdf_generated_file20200423-33047-1hbwcmu.pdf"] Error: PDF could not be generated! Command 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 <gem_name>). If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names. /.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/wkhtmltopdf-binary-edge-0.12.2.1/bin/wkhtmltopdf:17:in exec': Bad CPU type in executable - /.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/wkhtmltopdf-binary-edge-0.12.2.1/libexec/wkhtmltopdf-darwin-x86 (Errno::E086) from /.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/wkhtmltopdf-binary-edge-0.12.2.1/bin/wkhtmltopd`

System specifications

wicked_pdf gem version: 0.11.0

wkhtmltopdf version (output of wkhtmltopdf --version): 0.12.5 (with patched qt)

wkhtmltopdf-binary version: 0.12.4

wkhtmltopdf-binary-edge version: 0.12.2.1

platform/distribution and version: MacOS Catalina

Rails version: 4.2.1

RubenGram avatar Apr 24 '20 15:04 RubenGram

You don't need both wkhtmltopdf-binary and wkhtmltopdf-binary-edge you should be using only one of those.

darrenterhune avatar Apr 24 '20 16:04 darrenterhune

You don't need both wkhtmltopdf-binary and wkhtmltopdf-binary-edge you should be using only one of those.

Thanks for replying, do you have a suggestion about which should I use? And gem uninstall 'gemname' would be enough?

RubenGram avatar Apr 24 '20 16:04 RubenGram

This really depends on your platform. Locally I've installed it with homebrew on Mac OS X. In this case you could just use the wkhtmltopdf-binary. For us we also have CircleCI which requires a specific version so we do this in our Gemfile

gem "wkhtmltopdf-binary-edge", "~> 0.12.4.0" if ENV["CIRCLECI"]

Then because we deploy on Heroku we again have this in our :production group:

group :production, :staging do
  gem "wkhtmltopdf-heroku"
end

If your simply developing this locally and then deploying it on your own Ubuntu distro you would probably be fine with just wkhtmltopdf-binary

darrenterhune avatar Apr 24 '20 18:04 darrenterhune

Additionally, If you look at the README for the wkhtmltopdf-binary-edge gem, it's recommended for use in development & testing only. This is because it includes binaries for various operating systems and therefore large in size.

Alternatively, you could install wkhtmltopdf directly (https://github.com/wkhtmltopdf/wkhtmltopdf/releases) and point the exe_path in initializers/wicked_pdf.rb to the location of the executable.

Wmeng98 avatar Jun 30 '20 17:06 Wmeng98