更新到Ubuntu 22.04后,我无法使用Jekyll。
bundle exec jekyll serve
产生这个错误:
...
done in 8.248 seconds.
jekyll 3.9.0 | Error: no implicit conversion of Hash into Integer
/var/lib/gems/3.0.0/gems/pathutil-0.16.2/lib/pathutil.rb:502:in `read': no implicit conversion of Hash into Integer (TypeError)
from /var/lib/gems/3.0.0/gems/pathutil-0.16.2/lib/pathutil.rb:502:in `read'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/utils/platforms.rb:75:in `proc_version'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/utils/platforms.rb:40:in `bash_on_windows?'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:77:in `watch'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:43:in `process'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `block in start'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `each'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `start'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
from /var/lib/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /var/lib/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /var/lib/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /var/lib/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /var/lib/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /var/lib/gems/3.0.0/gems/jekyll-3.9.0/exe/jekyll:15:in `<top (required)>'
from /usr/local/bin/jekyll:25:in `load'
from /usr/local/bin/jekyll:25:in `<top (required)>'
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `load'
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `kernel_load'
...
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /var/lib/gems/3.0.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
from /usr/bin/bundle:25:in `load'
from /usr/bin/bundle:25:in `<main>'
有什么建议如何解决这个问题吗?
jekyll repo: https://github.com/schmidb/TurtleTrafo
可能是Ruby 3的问题,参见:
- https://talk.jekyllrb.com/t/error-no-implicit-conversion-of-hash-into-integer/5890/7
- https://github.com/envygeeks/pathutil/issues/4
第二个链接建议降级到Ruby/Bundler 2.7
在这个线程中还有一个有趣的信息:
在4月26日Jekyll v3.9.2最终删除了Jekyll对pathutil的主要依赖。现在Github Pages已经更新到Jekyll的那个版本(参见https://github.com/github/pages-gem/pull/833),这个问题应该不会再影响Github Pages或Jekyll了。
Gemfile。锁显示Jekyll 3.9.2,所以问题应该已经解决了。