gpt4 book ai didi

ruby - 杰基尔服务错误 : no implicit conversion of nil into String

转载 作者:数据小太阳 更新时间:2023-10-29 07:08:12 24 4
gpt4 key购买 nike

我用这个错误搜索了 jekyll。jekyll 处理页面时似乎出现了 ruby​​ 错误,但我根本不了解 ruby​​。

杰基尔版本 1.3.1

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

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

E:\GitHub\sample>jekyll 服务 --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 损坏。

最佳答案

您的 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 测试)

关于ruby - 杰基尔服务错误 : no implicit conversion of nil into String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20347604/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com