jekyll发送错误:没有将nil隐式转换为String

时间:2013-12-03 09:44:22

标签: ruby jekyll

我已经用这个错误搜索了jekyll。当jekyll处理页面时,似乎发生了ruby错误,但我根本不理解ruby。

jekyll版本1.3.1

我甚至重新安装了ruby和jekyll,但结果并没有改变。

更新
我将jekyll从1.31降级到1.20后这个错误消失了 注意:我用jekyll 1.20创建了我的网站,所以它不能用1.3.1构建?这是核心问题吗?

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)>'

更新测试样本
test repo
完成工作从1.20到1.30,从1.3.1打破到1.4.3。

1 个答案:

答案 0 :(得分:1)

您的ArchivePage#initialize未设置所需的属性。

来自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@month来确定页面的相对路径。在ArchivePage#initialize中设置这两个属性,它将再次起作用。 (经过1.3.1测试)