【问题标题】:How do I resolve this bundle update error when trying to use jekyll?尝试使用 jekyll 时如何解决此捆绑更新错误?
【发布时间】:2021-07-16 14:54:30
【问题描述】:

我在运行 jekyll 以创建 GitHub 页面时遇到问题。按照documentation 中列出的说明进行操作后,我在编辑 Gemfile 并尝试运行bundle update 后不断收到错误消息。错误是:

Bundler could not find compatible versions for gem "terminal-table":
  In snapshot (Gemfile.lock):
    terminal-table (>= 2.0.0)

  In Gemfile:
    github-pages (~> 215) was resolved to 215, which depends on
      terminal-table (~> 1.4)'


  I reinstalled terminal-table using 'gem install terminal-table', and listing my gems using 'gem list' I can see that I have version 3.0.1 installed, so I don't understand the error.

Thanks.

Gemfile

source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.2.0"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", "~> 215", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", "~> 1.2"
  gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    colorator (1.1.0)
    concurrent-ruby (1.1.9)
    em-websocket (0.5.2)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    eventmachine (1.2.7)
    ffi (1.15.3)
    forwardable-extended (2.6.0)
    http_parser.rb (0.6.0)
    i18n (1.8.10)
      concurrent-ruby (~> 1.0)
    jekyll (4.2.0)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 1.0)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.3)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.4.0)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 2.0)
    jekyll-feed (0.15.1)
      jekyll (>= 3.7, < 5.0)
    jekyll-sass-converter (2.1.0)
      sassc (> 2.0.1, < 3.0)
    jekyll-seo-tag (2.7.1)
      jekyll (>= 3.8, < 5.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.3.1)
      rexml
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.3)
    listen (3.5.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    mercenary (0.4.0)
    minima (2.5.1)
      jekyll (>= 3.5, < 5.0)
      jekyll-feed (~> 0.9)
      jekyll-seo-tag (~> 2.1)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (4.0.6)
    rb-fsevent (0.11.0)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    rexml (3.2.5)
    rouge (3.26.0)
    safe_yaml (1.0.5)
    sassc (2.4.0)
      ffi (~> 1.9)
    terminal-table (2.0.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    unicode-display_width (1.7.0)

PLATFORMS
  x86_64-darwin-19

DEPENDENCIES
  jekyll (~> 4.2.0)
  jekyll-feed (~> 0.12)
  minima (~> 2.5)
  tzinfo (~> 1.2)
  tzinfo-data
  wdm (~> 0.1.1)

BUNDLED WITH
   2.2.24

【问题讨论】:

  • 发布您的 gemfile 和 gemfile.lock。当您执行gem install 时,您正在安装到您的系统红宝石而不是您的本地包。坚持编辑 Gemfile 为您的项目安装东西。
  • 在上面添加了gemfile和gemfile.lock
  • 请尝试应用一些代码格式来提高您问题的可读性。查看文本编辑器的帮助部分了解详细信息。

标签: ruby jekyll github-pages


【解决方案1】:

只需删除 .lock 文件并捆绑安装即可。你会得到一个新的。

【讨论】:

  • 工作正常,节省了我的时间,谢谢。
【解决方案2】:

我只是将Gemfile.lock 中的terminal-table (&gt;= 2.0.0) 更改为terminal-table (~&gt; 1.4)。这似乎适用于我的环境。希望这对你有用!

【讨论】:

  • Gemfile.lock是运行bundle installbundle update生成的,所以不要直接更新。
  • @Ross 我是 Ruby 新手,我可能错了,谢谢你的建议。但是,我通过使用直接更改Gmefile.lock的方法解决了上述问题。我不知道为什么。只是想与社区分享。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-27
  • 2021-08-20
  • 2020-02-03
  • 2020-02-07
  • 2019-04-17
相关资源
最近更新 更多