Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jekyll serve error: no implicit conversion of nil into String

Tags:

ruby

jekyll

I have searched jekyll with this error.It seems a ruby error occur while jekyll processing pages, but I don't understand ruby at all.

jekyll version 1.3.1

I even reinstall ruby and jekyll, but the result doesn't change.

UPDATE:
This error disappeared after I degraded jekyll from 1.31 to 1.20
note:I created my site by jekyll 1.20, so it coundn't build with 1.3.1? is this the core problem ?

E:\GitHub\sample>jekyll serve --trace :

Configuration file: E:/GitHub/sample/_config.yml
            Source: E:/GitHub/sample
       Destination: E:/GitHub/sample/_site
      Generating... D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/page.rb:127:in `join': no implicit conversion of nil int
o String (TypeError)
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/page.rb:127:in `relative_path'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/page.rb:122:in `path'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/generators/pagination.rb:118:in `pagination_candidate?'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/generators/pagination.rb:77:in `block in template_page'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/generators/pagination.rb:76:in `select'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/generators/pagination.rb:76:in `template_page'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/generators/pagination.rb:17:in `generate'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/site.rb:229:in `block in generate'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/site.rb:228:in `each'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/site.rb:228:in `generate'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/site.rb:38:in `process'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/command.rb:18:in `process_site'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/commands/build.rb:23:in `build'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/lib/jekyll/commands/build.rb:7:in `process'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/jekyll-1.3.1/bin/jekyll:97:in `block (2 levels) in <top (required)>'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
        from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'

update test sample
test repo
Work perfect from 1.20 to 1.30 and broken from 1.3.1 to 1.4.3.

like image 707
Mithril Avatar asked Dec 03 '13 09:12

Mithril


1 Answers

Your ArchivePage#initialize is not setting the required attributes.

From Jekyll page.rb:

def initialize(site, base, dir, name)
  @site = site
  @base = base
  @dir  = dir
  @name = name

  self.process(name)
  self.read_yaml(File.join(base, dir), name)
end

@dir and @month are required for determining the relative path of the page when preparing the site generation. Set those two attributes in ArchivePage#initialize and it will work again. (Tested with 1.3.1)

like image 191
mhutter Avatar answered Oct 14 '22 22:10

mhutter