【问题标题】:Github Pages can't find Jekyll theme "Minimal Mistakes"Github Pages 找不到 Jekyll 主题“Minimal Mistakes”
【发布时间】:2022-02-09 04:26:35
【问题描述】:

我在 Github Pages 上用 Jakyll 创建了一个个人博客,它在默认主题下完美运行。

然后我(在本地)安装了主题 Minimal Mistakes 并致力于添加一些自定义项。它在本地运行良好。

我在 Windows 10 上使用 VS Code。

然后我提交并同步了 repo,但 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>'

/usr/local/lib/ruby/2.7.0/rubygems/dependency.rb:311:in to_specs': Could not find 'minimal-mistakes-jekyll' (&gt;= 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 envfor more information from /usr/local/lib/ruby/2.7.0/rubygems/dependency.rb:323:into_spec' 来自 /usr/local/lib/ruby/2.7.0/rubygems/specification.rb:986:in 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:in root' from /usr/local/bundle/gems/jekyll-3.9.0/lib/jekyll/theme.rb:12:in initialize' 来自 /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' 来自 /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' 来自 /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' 从 /usr/local/bundle/gems/github-pages-223/bin/github-pages:70:in block (3 levels) in &lt;top (required)&gt;' from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in block 在执行' 来自 /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' 来自 /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' 来自 /usr/local/bundle/gems/github-pages-223/bin/github-pages:6:in &lt;top (required)&gt;' from /usr/local/bundle/bin/github-pages:23:in load' 来自 /usr/local/bundle/bin/github-pages:23:in `' 在级别记录:调试 配置文件:/github/workspace/./_config.yml 主题:最小错误-jekyll github-第 223 页 |错误:找不到最小错误 jekyll 主题。

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

你可以看看我的 repo here

【问题讨论】:

    标签: ruby rubygems jekyll github-pages jekyll-theme


    【解决方案1】:

    据我所知,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 }}
    

    然后将发布分支更改为gh-pages

    【讨论】:

    • 不,谢谢,这太令人困惑了。这与我实际使用的程序完全不同,而且没有帮助。不过还是谢谢。
    • 我明白这一点。 Github 页面是很久以前创建的,我也期望在创建我的 Jekyll 博客时会有不同的行为。但从那以后,事情变得有点复杂了。据我所知,我所描述的是一种将内容发布到 GHP 的标准方式,支持各种静态页面生成器,不仅是 Jekyll。
    【解决方案2】:

    我将远程主题插件的使用与 Gem 主题方法混淆了,在本地进行了一些操作。我已经清理了我的 Gemfile 和 _config.yml,现在一切正常。

    我在本地使用 Ruby 3.0,然后 Github Pages 使用 2.7 显然并不重要。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-14
      • 1970-01-01
      • 2023-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多