gem“jekyll”的捆绑器兼容版本

Sam*_*Kim 4 ruby blogs dependencies jekyll

我正在尝试使用 Jekyll 设置 github 页面,目前它使用的是minima theme,我想将其更改为jekyll-theme-hacker

所以,我去了 Gemfile,我补充说

gem "github-pages", group:jekyll_plugins
Run Code Online (Sandbox Code Playgroud)

在下面

gem "minima", "~>2.5"
Run Code Online (Sandbox Code Playgroud)

保存后,我做了

bundle install
Run Code Online (Sandbox Code Playgroud)

但这给了我错误。

Bundler could not find compatible versions for gem "jekyll":
  In snapshot (Gemfile.lock):
    jekyll (= 4.0.0)

  In Gemfile:
    jekyll (~> 4.0.0)

    jekyll-theme-hacker was resolved to 0.0.4, which depends on
      jekyll (~> 3.3)

Running `bundle update` will rebuild your snapshot from scratch, using
only
the gems in your Gemfile, which may resolve the conflict.
Run Code Online (Sandbox Code Playgroud)

我对 Jekyll 和编程很陌生,我想知道为什么会这样。

据我所知,Bundler 是一个 Gem 管理工具,Gem 代表 ruby​​ 编程语言的库或模块。所以我试图做的是尝试为我的新主题安装所有必要的东西。

但是 bundler 找不到 gem "jekyll" 的兼容版本。这究竟是什么意思?我需要不同的 jekyll 依赖来使用我的新主题吗?如果是这样,我该怎么做?

非常感谢。

----编辑---- 这就是我的Gemfile.lock 的样子

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    colorator (1.1.0)
    concurrent-ruby (1.1.5)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    eventmachine (1.2.7)
    ffi (1.11.1)
    forwardable-extended (2.6.0)
    http_parser.rb (0.6.0)
    i18n (1.7.0)
      concurrent-ruby (~> 1.0)
    jekyll (4.0.0)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (>= 0.9.5, < 2)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.1)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.3.3)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 1.8)
    jekyll-feed (0.12.1)
      jekyll (>= 3.7, < 5.0)
    jekyll-sass-converter (2.0.1)
      sassc (> 2.0.1, < 3.0)
    jekyll-seo-tag (2.6.1)
      jekyll (>= 3.3, < 5.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.1.0)
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.3)
    listen (3.2.0)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    mercenary (0.3.6)
    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.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.10.0)
      ffi (~> 1.0)
    rouge (3.11.1)
    safe_yaml (1.0.5)
    sassc (2.2.1)
      ffi (~> 1.9)
    terminal-table (1.8.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    thread_safe (0.3.6)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    tzinfo-data (1.2019.3)
      tzinfo (>= 1.0.0)
    unicode-display_width (1.6.0)
    wdm (0.1.1)

PLATFORMS
  ruby

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

BUNDLED WITH
   2.0.2
Run Code Online (Sandbox Code Playgroud)

Dav*_*uel 8

你的Gemfile 的内容:

source 'https://rubygems.org'
gem 'github-pages'
Run Code Online (Sandbox Code Playgroud)

删除你的Gemfile.lock

启动bundle命令。

就是这样 !您已准备好部署到 github 页面。


小智 1

发生这种情况是因为您请求的 Jeykll 版本存在冲突。一种选择是降级您正在使用的 Jeykll 版本,方法是在您的Gemfile

-jekyll (~> 4.0.0)
+jekyll (~> 3.3)
Run Code Online (Sandbox Code Playgroud)

然后运行bundle update jekyll

如果您想运行最新版本,您可以分叉 Gem,更新jekyll依赖项版本并测试更改。如果它按预期工作,您应该向原始存储库提交 PR,并可以在等待合并时使用分叉。