Could not find public_suffix-3.0.3 in any of the sources (Bundler::GemNotFound)

重新安装了服务器,Jekyll无法启动

jekyll serve
Traceback (most recent call last):
        10: from /usr/local/bin/jekyll:23:in `<main>'
         9: from /usr/local/bin/jekyll:23:in `load'
         8: from /usr/local/share/gems/gems/jekyll-4.1.1/exe/jekyll:11:in `<top (required)>'
         7: from /usr/local/share/gems/gems/jekyll-4.1.1/lib/jekyll/plugin_manager.rb:52:in `require_from_bundler'
         6: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
         5: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
         4: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
         3: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
         2: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
         1: from /usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
/usr/local/share/gems/gems/bundler-2.1.4/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated i18n 1.8.5, but your Gemfile requires i18n 0.9.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

2. 解决

直接 Google 错误的内容, 然后前几篇文章都看看, 没解决的话就换换关键词重新搜索试试…

Well, I usually need to update the gem path in my $PATH environment variable when changing ruby minor versions (2.2 -> 2.3 -> 2.4 -> 2.5), otherwise it could not find the gems.

After changing the $PATH, a “bundle update” would fix it.

我这里的执行了2步:

# 想重新安装一遍 jekyll 的, 不过没有好使
$ gem install bundler jekyll

# 更新所有的 gems
$ bundle update

# 测试:启动成功
jekyll serve