Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method try_require #7

Open
Mariu5 opened this issue Nov 14, 2016 · 20 comments
Open

undefined method try_require #7

Mariu5 opened this issue Nov 14, 2016 · 20 comments

Comments

@Mariu5
Copy link

Mariu5 commented Nov 14, 2016

I got an Error if i try bulid the site with Jekyll 3.3.0

/Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll/pdf/liquid/tags/jekyll-assets.rb:1:in `<top (required)>': undefined method `try_require' for main:Object (NoMethodError)
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll/pdf.rb:1:in `require'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll/pdf.rb:1:in `block in <top (required)>'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll/pdf.rb:1:in `each'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll/pdf.rb:1:in `<top (required)>'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll-pdf.rb:1:in `require'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-pdf-0.1.6/lib/jekyll-pdf.rb:1:in `<top (required)>'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/external.rb:43:in `require'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/external.rb:43:in `block in require_with_graceful_fail'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/external.rb:40:in `each'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/external.rb:40:in `require_with_graceful_fail'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/plugin_manager.rb:27:in `require_gems'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/plugin_manager.rb:19:in `conscientious_require'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/site.rb:111:in `setup'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/site.rb:33:in `initialize'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/commands/doctor.rb:21:in `new'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/commands/doctor.rb:21:in `process'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/commands/doctor.rb:15:in `block (2 levels) in init_with_program'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /Users/doc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/exe/jekyll:13:in `<top (required)>'
	from /Users/doc/.rbenv/versions/2.3.1/bin/jekyll:23:in `load'
	from /Users/doc/.rbenv/versions/2.3.1/bin/jekyll:23:in `<main>'

An idea what caused this?

@abemedia
Copy link
Owner

abemedia commented Nov 14, 2016 via email

@tomkralidis
Copy link

tomkralidis commented Dec 3, 2016

Same error here with Jekyll 3.3.1

@lakshmanbasnet
Copy link

any solutions found?

@toddstoffer
Copy link

I am getting the same error using Jekyll 3.3.1 - @abemedia can you point me to a repo where this is working so I can compare it with my local repo?

@tersor
Copy link

tersor commented Jan 13, 2017

I got this too using Jekyll 3.3.1. Fixed by adding jekyll-assets.

Gemfile:

gem 'jekyll-assets'
gem 'jekyll-pdf'

_config.yml:

gems:
  - jekyll-assets
  - jekyll-pdf

@toddstoffer
Copy link

@tersor Any chance you could link to the repo that you have this working in? I have added jekyll-assets to the gemfile and config and am still getting the same error as before when I run jekyll build. Also running Jekyll 3.3.1.

@trallard
Copy link

trallard commented Feb 9, 2017

Having the same issue (Jekyll 3.3.1) has anyone found a solution?
I also added -jekyll-assets but it did not help

@Pietermachiel
Copy link

Same issue here with Jekyll 3.4.1

@bitgal
Copy link

bitgal commented Jun 8, 2017

same isuue, jekyll 3.4.3

@antgel
Copy link

antgel commented Jun 10, 2017

I did what @tersor suggested, it worked, then I ran into Issue #8. :(

Those of you for whom it's not working, make sure you added jekyll-assets to _config.yml.

@shivabhusal
Copy link

After I did what @tersor suggested

Gemfile:

gem 'jekyll-assets'
gem 'jekyll-pdf'
_config.yml:

gems:
  - jekyll-assets
  - jekyll-pdf

I ran into this error

jekyll 3.5.0 | Error:  undefined method `data' for nil:NilClass

@TheOddler
Copy link

I have the same issue as @shivabhusal

Using jekyll 3.5.1

No fixes? :(

@zhulik
Copy link

zhulik commented Sep 28, 2017

@shivabhusal @TheOddler it can be fixed by setting existing layout in config for pdf.

@Karakaz
Copy link

Karakaz commented Nov 14, 2017

@zhulik I tried to set it like this but it didn't work..

pdf:
  layout: pdf

Also updated my gems with bundle update. Still getting this

jekyll 3.6.2 | Error:  undefined method `data' for nil:NilClass

@tomstaijen
Copy link

bundle resolved this to a very old version of jekyll-assets because some other gem (jekyll-picture-tag) required an older version of fastimage (1.6). Newer versions of jekyll-assets, with try_require, need fastimage ~> 1.8.

So just fix your jekyll-assets version to ~> 2, run bundle install, and see what's conflicting.

@kaiforsyth
Copy link

@tomstaijen – this worked for me! Thanks!

@DonLewisFSI
Copy link

I had this working until I upgraded to jekyll 3.7.0. Now:

/usr/local/lib/ruby/gems/2.4/gems/jekyll-pdf-0.1.7/lib/jekyll/pdf/liquid/tags/jekyll-assets.rb:1:in <top (required)>': undefined method try_require' for main:Object (NoMethodError)
from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in require' from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in require'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-pdf-0.1.7/lib/jekyll/pdf.rb:1:in block in <top (required)>' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-pdf-0.1.7/lib/jekyll/pdf.rb:1:in each'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-pdf-0.1.7/lib/jekyll/pdf.rb:1:in <top (required)>' from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in require'
from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in require' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-pdf-0.1.7/lib/jekyll-pdf.rb:1:in <top (required)>'
from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:135:in require' from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:135:in rescue in require'
from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:39:in require' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/external.rb:58:in block in require_with_graceful_fail'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/external.rb:55:in each' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/external.rb:55:in require_with_graceful_fail'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/plugin_manager.rb:30:in require_gems' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/plugin_manager.rb:22:in conscientious_require'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/site.rb:113:in setup' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/site.rb:34:in initialize'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:30:in new' from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:30:in process'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:18:in block (2 levels) in init_with_program' from /usr/local/lib/ruby/gems/2.4/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in block in execute'
from /usr/local/lib/ruby/gems/2.4/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in each' from /usr/local/lib/ruby/gems/2.4/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in execute'
from /usr/local/lib/ruby/gems/2.4/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in go' from /usr/local/lib/ruby/gems/2.4/gems/mercenary-0.3.6/lib/mercenary.rb:19:in program'
from /usr/local/lib/ruby/gems/2.4/gems/jekyll-3.7.0/exe/jekyll:15:in <top (required)>' from /usr/local/bin/jekyll:23:in load'
from /usr/local/bin/jekyll:23:in `

'

%gem list

*** LOCAL GEMS ***

activesupport (5.1.4)
addressable (2.5.2)
colorator (1.1.0)
concurrent-ruby (1.0.5)
digest (0.0.1)
em-websocket (0.5.1)
eventmachine (1.2.5)
execjs (2.7.0)
extras (0.3.0)
fastimage (2.1.1)
ffi (1.9.18)
flvtool2 (1.0.6)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (0.9.1)
jekyll (3.7.0)
jekyll-assets (3.0.5)
jekyll-paginate (1.1.0)
jekyll-pdf (0.1.7)
jekyll-sanity (1.2.0)
jekyll-sass-converter (1.5.1)
jekyll-watch (2.0.0)
kramdown (1.16.2)
liquid (4.0.0)
liquid-tag-parser (1.8.0)
listen (3.1.5)
mercenary (0.3.6)
minitest (5.11.1)
nokogiri (1.8.1)
pathutil (0.16.1)
pdfkit (0.8.2)
pkg-config (1.2.8)
public_suffix (3.0.1)
rack (1.6.8)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
rb-kqueue (0.2.5)
rouge (2.2.1)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.5.5)
sass-listen (4.0.0)
sprockets (3.7.1)
thread_safe (0.3.6)
tzinfo (1.2.4)

@DonLewisFSI
Copy link

My problem turned out to be with the new version of jekyll-assets (3.0.5). I had also recently upgraded ruby and had to reinstall all the gems since I last used jekyll-pdf. I dropped back to jekyll-assets 2.4.0 and things are now working again. I don't know if the earlier 3.0.x versions of jekyll-assets work.

@mneumegen
Copy link

Fixed in this PR - #17

@hoijui
Copy link

hoijui commented Jun 29, 2019

see #24

it also contains mneumegen's fix for this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests