Open apolzon opened 10 years ago
I also encountered this issue
+1
I'm seeing the same issue and it cropped up unexpectedly. One minute it worked great and continues to work in staging. In the local Ubuntu image where it was working it's erroring out even after reverting the code, restarting the box, restarting the server.
In my case it was throwing this error: "git://github.com/nixme/jazz_hands.git (at bring-your-own-debugger) is not yet checked out. Run bundle install
first."
Commenting that Gem out and bundling made the error go away.
Having this issue as well.
Ruby 2.1.2 Rails 4.1.0
Offending lines in Gemfile:
gem 'figaro', github: "laserlemon/figaro" gem 'Indirizzo', git: 'https://github.com/daveworth/Indirizzo.git'
Commenting out either of them, or even just their git components, fixes the problem.
edit:
***************WICKED***************
Rendered searches/search.pdf.haml (4.9ms)
"***************[\"/home/andrew/.rvm/gems/ruby-2.1.2/bin/wkhtmltopdf\", \"-q\", \"file:///tmp/wicked_pdf20150101-3960-1iptntr.html\", \"/tmp/wicked_pdf_generated_file20150101-3960-zncuxz.pdf\"]***************"
Completed 500 Internal Server Error in 1027ms
RuntimeError (Error: Failed to execute:
["/home/andrew/.rvm/gems/ruby-2.1.2/bin/wkhtmltopdf", "-q", "file:///tmp/wicked_pdf20150101-3960-1iptntr.html", "/tmp/wicked_pdf_generated_file20150101-3960-zncuxz.pdf"]
Error: PDF could not be generated!
Command Error: /home/andrew/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/source/git.rb:188:in `rescue in load_spec_files': https://github.com/daveworth/Indirizzo.git (at master) is not yet checked out. Run `bundle install` first. (Bundler::GitError)
from /home/andrew/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.7/lib/bundler/source/git.rb:185:in `load_spec_files'
If you specify the path to your binary manually in config/initializers/wicked_pdf.rb
using your own path to the binary as shown here: https://github.com/mileszs/wicked_pdf#installation
Then you'll bypass the bundle exec wkhtmltopdf
part and it will just run wkhtmltopdf
with the options it needs.
This is what I am doing to address this:
gem install wkhtmtopdf-binary
in global
gemsetgem 'wkthmltopdf-binary'
to Gemfile
bundle binstubs wkhtmltopdf-binary
, which generates bin/wkhtmltopdf
wkhtmltopdf: File.join(Rails.root, 'bin/wkhtmltopdf')
in config/initializers/wicked_pdf.rb
If you specify the path to your binary manually in config/initializers/wicked_pdf.rb using your own path to the binary as shown here: https://github.com/mileszs/wicked_pdf#installation
Then you'll bypass the bundle exec wkhtmltopdf part and it will just run wkhtmltopdf with the options it needs.
Doesn't work for me.
Error before: Location of wkhtmltopdf unknown
because of the exception in bundle exec, so that find_wkhtmltopdf_binary_path
returns nil
Error after: Error: Failed to execute: path/to/wkhtmltopdf
. Same reason as above is not yet checked out.
...
This is what I am doing to address this:
(Optional) run gem install wkhtmtopdf-binary in global gemset Add gem 'wkthmltopdf-binary' to Gemfile Run bundle binstubs wkhtmltopdf-binary, which generates bin/wkhtmltopdf Set wkhtmltopdf: File.join(Rails.root, 'bin/wkhtmltopdf') in config/initializers/wicked_pdf.rb
Didn't work too. Looking for another solution
Rails 4.2.0 Ruby 2.1.5 OSX 10.10.2 rvm 1.26.10
It is caused by spring, I suppose, offending line:
bin/spring.rb
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast
# It gets overwritten when you run the `spring binstub` command
unless defined?(Spring)
require "rubygems"
require "bundler"
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = "" # <-- this is causing the issue
Gem.paths = ENV
gem "spring", match[1]
require "spring/binstub"
end
end
confirmed spring is the issue. If you're running on a fast machine I would just remove spring, it causes way more headaches than benefits.
I just ran into this error...
(at master) is not yet checked out. Run `bundle install` first. (Bundler::GitError)`)
...using a github repo to supply the wkhtmlpdf binaries.
After dumping a bunch of STDERR.puts
in my bundler gem, I found Bundler's source/git.rb
was using my project folder as the gem install path instead of rvm's. Thanks to this issue, I considered spring as the culprit and visited their github page where they recommend running...
bundle exec spring binstub --all
which fixed this error for me. YMMV since I'm only dealing with a github gem full of binaries instead of paperclip and the like. Cheers.
When Wicked PDF attempts to find the wkhtmltopdf binary path, it attempts to shell out to bundle exec to determine the location of the wkhtmltopdf binary. However, this will execute bundle exec in a new shell which will use a global gemset, triggering a bundler error as many gems will likely not be installed.
ie:
I'm not sure what the correct way to handle this is, but it might be worth adding a note to the Readme regarding this issue.