You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Pages本地Jekyll Serve运行报错求助

解决Ruby 3.4环境下Jekyll启动的csv加载错误与警告

问题重现

执行命令:

bundle exec jekyll serve

出现报错:

C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/jekyll-4.3.4/lib/jekyll.rb:26: warning: logger was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.

You can add logger to your Gemfile or gemspec to silence this warning.

C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/jekyll-4.3.4/lib/jekyll.rb:28: warning: csv was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0.
You can add csv to your Gemfile or gemspec to silence this warning.
C:/Ruby34-x64/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require': cannot load such file -- csv (LoadError)
        from C:/Ruby34-x64/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/jekyll-4.3.4/lib/jekyll.rb:28:in '<top (required)>'
        from C:/Ruby34-x64/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
        from C:/Ruby34-x64/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/jekyll-4.3.4/exe/jekyll:8:in '<top (required)>'
        from C:/Ruby34-x64/bin/jekyll:36:in 'Kernel#load'
        from C:/Ruby34-x64/bin/jekyll:36:in '<main>'

解决方案

  1. 打开项目根目录的Gemfile,添加以下两行:
    gem 'csv'
    gem 'logger'
    
  2. 执行命令安装依赖:
    bundle install
    
  3. 重新启动Jekyll:
    bundle exec jekyll serve
    

原因说明

  • Ruby 3.4版本开始,csv不再作为默认标准库gem包含,而Jekyll 4.3.4仍依赖该库,因此需要手动在Gemfile中声明引入。
  • logger的警告是预告Ruby 3.5版本将移除其默认gem状态,提前添加可避免后续版本升级时出现类似错误。

内容的提问来源于stack exchange,提问作者PBI DataVizzle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 02:42:36