Home > Software engineering >  Github Pages can't find Jekyll theme "Minimal Mistakes"
Github Pages can't find Jekyll theme "Minimal Mistakes"

Time:02-10

I've made a personal blog with Jakyll on Github Pages, it was working flawlessly with the default theme.

Then I've (locally) installed the theme Minimal Mistakes and worked on it to add some customizations. It works fine locally.

I'm using VS Code on Windows 10.

I then committed and synced the repo but GitHub Pages can't load the new theme apparently. The blog still works with the old one but I've got this error message from 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' (>= 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' from /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' 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 `' Logging at level: debug Configuration file: /github/workspace/./_config.yml Theme: minimal-mistakes-jekyll github-pages 223 | Error: The minimal-mistakes-jekyll theme could not be found.

I've originally installed (and developed the whole blog) Ruby 3.0. I suspect GitHub Pages needs 2.7.0?

You can have a look at my repo here

CodePudding user response:

From what I know, GitHub Pages Jekyll generator is quite limited at what it can do. It doesn't support too much customization, especially not adding new gems. What you actually need to do is to push a static CSS/HTML site into GitHub Pages... generated with Jekyll, BUT for example by GitHub Actions.

All this is counter-intuitive, I know. But the solution is fairly simple.

All you need to do, is to follow the instruction located here: https://github.com/helaili/jekyll-action

The guide tells you, that all you need to do is to create a .github/workflows/pages.yml with the following content:

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 }}

And change the publishing branch to gh-pages afterwards.

CodePudding user response:

I was confusing the use of the remote theme plugin with the Gem theme method, doing a bit of both locally. I've cleaned up my Gemfile and my _config.yml and now it's all working properly.

The fact that I used Ruby 3.0 locally and then Github Pages uses 2.7 doesn't matter apparently.

  • Related