尝试使用 jekyll 时如何解决此包更新错误?

问题描述

我在运行 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,: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

解决方法

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

,

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