【问题标题】:How does one downgrade jekyll to work with github pages?如何降级 jekyll 以使用 github 页面?
【发布时间】:2019-10-28 20:39:21
【问题描述】:

我认为我的主要问题是 github 页面不支持 jekyll 4。这对我来说很好,但是无论如何我如何降级 jekyll 才能工作?

我尝试按照此处的说明进行操作:https://github.com/github/pages-gem/issues/577

这基本上似乎建议使用旧版本的 jekyll。我可以这样做,但似乎 bundle 拒绝服从我,我不知道为什么,或者我进入了一个我无法摆脱的奇怪循环。

所以我得到的主要错误是:

$ bundle
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
You have requested:
  jekyll ~> 3.8.5

The bundle currently has jekyll locked at 4.0.0.
Try running `bundle update jekyll`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

但似乎我被锁定到 4。我尝试解锁,但似乎无法让它工作。我最近的尝试如下:

$ gem install jekyll -v 3.8.5
Fetching kramdown-1.17.0.gem
Fetching jekyll-3.8.5.gem
Fetching sass-listen-4.0.0.gem
Fetching sass-3.7.4.gem
Fetching jekyll-sass-converter-1.5.2.gem
Fetching i18n-0.9.5.gem
Successfully installed kramdown-1.17.0
Successfully installed sass-listen-4.0.0

Ruby Sass has reached end-of-life and should no longer be used.

* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install

* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
  sassc gem: https://github.com/sass/sassc-ruby#readme

* For more details, please refer to the Sass blog:
  https://sass-lang.com/blog/posts/7828841

Successfully installed sass-3.7.4
Successfully installed jekyll-sass-converter-1.5.2
Successfully installed i18n-0.9.5
Successfully installed jekyll-3.8.5
Parsing documentation for kramdown-1.17.0
Installing ri documentation for kramdown-1.17.0
Parsing documentation for sass-listen-4.0.0
Installing ri documentation for sass-listen-4.0.0
Parsing documentation for sass-3.7.4
Installing ri documentation for sass-3.7.4
Parsing documentation for jekyll-sass-converter-1.5.2
Installing ri documentation for jekyll-sass-converter-1.5.2
Parsing documentation for i18n-0.9.5
Installing ri documentation for i18n-0.9.5
Parsing documentation for jekyll-3.8.5
Installing ri documentation for jekyll-3.8.5
Done installing documentation for kramdown, sass-listen, sass, jekyll-sass-converter, i18n, jekyll after 8 seconds
6 gems installed

但是在我尝试使用命令bundle 捆绑我的Gemfile 之后,我收到以下错误:

$ gem install jekyll -v 3.8.5
Fetching kramdown-1.17.0.gem
Fetching jekyll-3.8.5.gem
Fetching sass-listen-4.0.0.gem
Fetching sass-3.7.4.gem
Fetching jekyll-sass-converter-1.5.2.gem
Fetching i18n-0.9.5.gem
Successfully installed kramdown-1.17.0
Successfully installed sass-listen-4.0.0

Ruby Sass has reached end-of-life and should no longer be used.

* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install

* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
  sassc gem: https://github.com/sass/sassc-ruby#readme

* For more details, please refer to the Sass blog:
  https://sass-lang.com/blog/posts/7828841

Successfully installed sass-3.7.4
Successfully installed jekyll-sass-converter-1.5.2
Successfully installed i18n-0.9.5
Successfully installed jekyll-3.8.5
Parsing documentation for kramdown-1.17.0
Installing ri documentation for kramdown-1.17.0
Parsing documentation for sass-listen-4.0.0
Installing ri documentation for sass-listen-4.0.0
Parsing documentation for sass-3.7.4
Installing ri documentation for sass-3.7.4
Parsing documentation for jekyll-sass-converter-1.5.2
Installing ri documentation for jekyll-sass-converter-1.5.2
Parsing documentation for i18n-0.9.5
Installing ri documentation for i18n-0.9.5
Parsing documentation for jekyll-3.8.5
Installing ri documentation for jekyll-3.8.5
Done installing documentation for kramdown, sass-listen, sass, jekyll-sass-converter, i18n, jekyll after 8 seconds
6 gems installed

好的,我会尝试更新,我会这样做bundle update

$ bundle update
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Bundler could not find compatible versions for gem "jekyll":
  In Gemfile:
    github-pages was resolved to 4, which depends on
      jekyll (= 1.1.2)

    jekyll-feed (~> 0.12) was resolved to 0.12.1, which depends on
      jekyll (>= 3.7, < 5.0)

Bundler could not find compatible versions for gem "jekyll-feed":
  In Gemfile:
    github-pages was resolved to 36, which depends on
      jekyll-feed (= 0.2.3)

    minima (~> 2.5) was resolved to 2.5.0, which depends on
      jekyll-feed (~> 0.9)

Bundler could not find compatible versions for gem "tzinfo":
  In Gemfile:
    tzinfo (~> 1.2)

    tzinfo-data was resolved to 1.2019.3, which depends on
      tzinfo (>= 1.0.0)

这让我卡住了......有什么想法可以做什么吗?

我也尝试按照Gemfile 中的说明进行操作,但没有成功:

$ bundle update github-pages
Could not find gem 'github-pages'.

通过运行他们说的命令,我得到了错误:

$ bundle update github-pages
Could not find gem 'github-pages'.

我也跑了这个bundle install:

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "jekyll-feed":
  In snapshot (Gemfile.lock):
    jekyll-feed (= 0.12.1)

  In Gemfile:
    github-pages was resolved to 36, which depends on
      jekyll-feed (= 0.2.3)

    minima (~> 2.5) was resolved to 2.5.1, which depends on
      jekyll-feed (~> 0.9)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

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

  In Gemfile:
    github-pages was resolved to 8, which depends on
      kramdown (= 1.0.2)

    minima (~> 2.5) was resolved to 2.5.1, which depends on
      jekyll-feed (~> 0.9) was resolved to 0.12.1, which depends on
        jekyll (>= 3.7, < 5.0) was resolved to 4.0.0, which depends on
          kramdown (~> 2.1)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

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

  In Gemfile:
    minima (~> 2.5)

    github-pages was resolved to 94, which depends on
      minima (= 1.0.1)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

我也做过:

gem install github-pages

安装了...不确定这是否让事情变得更糟...


我用来帮助我的资源:

但还没有人解决我的问题。

【问题讨论】:

  • "但是在我尝试使用命令 bundle 捆绑我的 Gemfile 之后,我收到以下错误" 但是您粘贴的文本块与上一个显示输出的文本块完全相同来自gem install,而不是来自bundle install
  • @anothermh 已更新,很抱歉对我正在尝试的所有命令感到困惑。这有帮助吗?
  • 不,因为您只说“我也运行了这个捆绑安装”,但没有说明您在事件序列中运行它的时间,并且您留下了不正确的信息这会显示您的 gem install 输出两次。
  • @anothermh 我知道这无济于事,但我已经在很多订单中运行了很多东西,所以我忘记了我做了什么。我很高兴重新写下这个问题。我会用谷歌搜索如何重新启动整个过程,除非你知道我该怎么做:)
  • 一个没有明确说明它是如何到达它的位置并且要求我们弄清楚它的问题可能不会受到欢迎。

标签: ruby rubygems jekyll bundler


【解决方案1】:

您的 Gemfile 应如下所示:

source 'https://rubygems.org'

# will install all gh-pages allowed gems
# see : https://pages.github.com/versions/
gem 'github-pages'

# comment out all other gems
# gem 'jekyll'
# gem 'jekyll-feed'
# gem ...

删除 Gemfile.lock

您现在可以执行bundle,它将安装所有需要的 gem,以针对实际的 github-pages 版本进行测试。

【讨论】:

  • 但是这里的说明 help.github.com/en/github/working-with-github-pages/… 说要做&gt; Update the gem "github-pages" line so that the line looks like this, replacing VERSION with the current dependency version for github-pages. For more information, see "Dependency versions" on the GitHub Pages site. 我尝试了以下但失败了:gem "github-pages", "~&gt; 3.8.5", group: :jekyll_plugins
  • “github-pages”位于version 202。如果您总是想要最新版本,则无需添加版本号。
  • 成功了,谢谢!
【解决方案2】:

当前版本的 github pages 需要你设置使用 Jekyll 3.8.5 和 github-pages 202。当我设置这个时,我还必须为 jekyll feed 设置一个特定的版本。以下是您在 Gemfile 中需要的相关行:

gem "jekyll", "~> 3.8.5"
gem "github-pages","~> 202" , group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.11.0"
end

之后,尝试删除您的 Gemfile.lock 并运行 bundle install

我有一个 repo here 并设置了最小版本。

【讨论】:

    猜你喜欢
    • 2013-06-26
    • 2017-11-12
    • 2019-02-19
    • 2021-08-11
    • 2014-07-19
    • 2021-06-24
    • 2020-10-11
    • 2018-04-01
    • 2013-02-19
    相关资源
    最近更新 更多