报错解决:Gem::InstallError: zeitwerk requires Ruby version >= 2.4.4.

此文首发于我的Jekyll博客:zhang0peter的个人博客


早上把GitHub Pages部署到coding Pages时,在构建时报错了:

2020/02/16 10:08:02 Installing zeitwerk 2.2.2
2020/02/16 10:08:02 Gem::InstallError: zeitwerk requires Ruby version >= 2.4.4.
2020/02/16 10:08:02 An error occurred while installing zeitwerk (2.2.2), and Bundler cannot
2020/02/16 10:08:02 .
2020/02/16 10:08:02 Make sure that `gem install zeitwerk -v '2.2.2'` succeeds before bundling.
2020/02/16 10:08:02 In Gemfile:
2020/02/16 10:08:02   activesupport was resolved to 6.0.2.1, which depends on
2020/02/16 10:08:02     zeitwerk
2020/02/16 10:08:03 Jekyll build exit with code 5.
2020/02/16 10:08:03 Fail to build jekyll site.

里面显示报错Gem::InstallError: zeitwerk requires Ruby version >= 2.4.4.gem install zeitwerk -v '2.2.2'

然后我在网上查找资料时,发现有挺多人遇到了这个报错:activesupport requires Ruby version >= 2.5.0. · Issue #184 · fabric8io/fluent-plugin-kubernetes_metadata_filter

出现这个报错的原因是activesupport这个包依赖的zeitwerk最近更新了,需要更高版本的ruby。

解决方法之一是指定activesupport版本,降级到5.0.0

另一个解决方法是不使用activesupport包。