Github Pages 找不到 Jekyll 主题“Minimal Mistakes”

mau*_*ion 5 ruby rubygems jekyll github-pages jekyll-theme

我在 Github Pages 上与 Jakyll 一起制作了一个个人博客,它在默认主题下完美运行。

然后我(本地)安装了主题“Minimal Mistakes”,并对其进行了添加一些自定义设置。在本地运行良好。

我在 Windows 10 上使用 VS Code。

然后我提交并同步了存储库,但 GitHub Pages 显然无法加载新主题。该博客仍然可以使用旧的博客,但我从 GitHUb Pages 收到此错误消息:

/usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:84:in `rescue in gemspec': The minimal-mistakes-jekyll theme could not be found. (Jekyll::Errors::MissingDependencyException)
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:81:in `gemspec'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:19:in `root'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:12:in `initialize'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:439:in `new'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:439:in `configure_theme'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:55:in `config='
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:23:in `initialize'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:30:in `new'
from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:30:in `process'
from /usr/local/bundle/gems/github-pages-223/bin/github-pages:70:in `block (3 levels) in <top (required)>'
from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /usr/local/bundle/gems/github-pages-223/bin/github-pages:6:in `<top (required)>'
from /usr/local/bundle/bin/github-pages:23:in `load'
from /usr/local/bundle/bin/github-pages:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)

/usr/local/lib/ruby/2.7.0/rubygems/dependency.rb:311 to_specs': Could not find 'minimal-mistakes-jekyll' (>= 0) among 159 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/github/home/.gem/ruby/2.7.0:/usr/local/lib/ruby/gems/2.7.0:/usr/local/bundle', execute :在 gem env for more information from /usr/local/lib/ruby/2.7.0/rubygems/dependency.rb:323:into_spec' 来自 /usr/local/lib/ruby/2.7.0/rubygems/specation.rb:986:find_by_name' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:82:in 在 gemspec ' 来自 /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:19:inroot' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:12:in 初始化' 来自 /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/ site.rb:439:在new' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:439:in configure_theme中'来自/usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:55 config=' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/site.rb:23:in :在initialize中'来自/usr/local/bundle/gems/jekyll- 3.9.0/lib/jekyll/commands/build.rb:30:in new' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:30:in process' from /usr/local/bundle/gems/github-pages-223/bin/github-pages:70:in block (3 levels) in <top (required)>' from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in block inexecute' from / usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:在each' from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb 中执行' :42:在go' from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in 程序中'来自 /usr/local/bundle/gems/github-pages-223/bin/github-pages:6:in<top (required)>' from /usr/local/bundle/bin/github-pages:23:in 加载'来自 /usr/local/bundle/bin/github-pages:23:in `' 日志级别:debug 配置文件:/github/workspace/./_config.yml 主题:minimal-mistakes-jekyll github-pages 223 | 错误:找不到最小错误 jekyll 主题。

我最初安装(并开发了整个博客)Ruby 3.0。我怀疑 GitHub Pages 需要 2.7.0?

你可以在这里查看我的仓库

hmd*_*dne 2

据我所知,GitHub Pages Jekyll 生成器的功能非常有限。它不支持太多的定制,尤其是不添加新的宝石。您实际需要做的是将静态 CSS/HTML 站点推送到 GitHub Pages 中...使用 Jekyll 生成,但例如通过 GitHub Actions 生成。

我知道这一切都是违反直觉的。但解决方案相当简单。

您需要做的就是按照此处的说明进行操作:https://github.com/helaili/jekyll-action

该指南告诉您,您所需要做的就是创建一个.github/workflows/pages.yml包含以下内容的文件:

name: Testing the GitHub Pages publication

on:
  push

jobs:
  jekyll:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    # Use GitHub Actions' cache to shorten build times and decrease load on servers
    - uses: actions/cache@v2
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
        restore-keys: |
          ${{ runner.os }}-gems-

    # Standard usage
    - uses:  helaili/jekyll-action@v2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
Run Code Online (Sandbox Code Playgroud)

并将发布分支更改为gh-pages之后。