rubyrubygemsjekyllbundlerjekyll-theme

Why can't I build a Jekyll site locally with this downloaded theme?


New to Ruby/Jekyll, but I am trying to install Jekyll locally on my Windows machine, and build a site with a downloaded theme. I am really struggling to get it to run. The theme I am trying to use is the Contrast theme. The steps I have taken are as follows:

  1. Following the instructions, first installed Ruby using the Ruby Installer here (choosing version Ruby+Devkit 3.3.7-1 [x64]). At the end of the installation, ran the ridk install option, and installed the MSYS2 base installation and the MSYS2 and MINGW development toolchain.
  2. In a command prompt, ran gem install jekyll bundler, which results in the following:
>bundler -v
Bundler version 2.6.7

>gem -v
3.5.22

>jekyll -v
jekyll 4.4.1 
  1. Downloaded the Contrast theme as a zip file and extracted it. This results in the following files:
myuser@mymachine MINGW64 ~/contrast-master
$ ls
_config.yml  _includes/  _posts/  404.html      assets/  Gemfile.lock  README.md
_data/       _layouts/   _sass/   archive.html  Gemfile  index.html    UNLICENSE.txt
  1. Navigated to the theme's local directory with a command terminal, and ran bundler install, which installed a series of required gems:
C:\Users\myuser\contrast-master>bundler install

Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Fetching rexml 3.4.1
Fetching rouge 3.30.0
Fetching unicode-display_width 1.8.0
Fetching sassc 2.4.0
Installing rexml 3.4.1
Installing unicode-display_width 1.8.0
Installing rouge 3.30.0
Fetching terminal-table 2.0.0
Installing sassc 2.4.0 with native extensions
Installing terminal-table 2.0.0
Fetching jekyll-sass-converter 2.2.0
Installing jekyll-sass-converter 2.2.0
Fetching jekyll 4.2.2
Installing jekyll 4.2.2
Fetching jekyll-feed 0.17.0
Installing jekyll-feed 0.17.0
Bundle complete! 3 Gemfile dependencies, 30 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
  1. Tried to build the jekyll site using bundle exec jekyll build, but it failed with a series of messages:
C:\Users\myuser\contrast-master>bundle exec jekyll build

C:/Ruby33-x64/bin/jekyll:25: warning: csv was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add csv to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:22: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/liquid-4.0.4/lib/liquid.rb:72: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add bigdecimal to your Gemfile or gemspec to silence this warning.
                    ------------------------------------------------
      Jekyll 4.2.2   Please append `--trace` to the `build` command
                     for any additional information or backtrace.
                    ------------------------------------------------
C:/Ruby33-x64/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:27:in `process'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby33-x64/bin/jekyll:25:in `load'
        from C:/Ruby33-x64/bin/jekyll:25:in `<main>'

Can anyone help see why this is not building, and help me fix it?


[Note, I want to run it locally because I want to A) work offline on the site and be able to have regular previews on my local machine's browser, and B) have access to the files in the _site folder that are generated by Jekyll in order to upload them directly to a web hosting service, rather than have the site built by the Jekyll engine on Github Pages, Cloudflare Pages, etc.]


EDIT

After trying to append the gem file with a newer version of jekyll as suggested in the answer from @lmtaq below,I now receive another error:

$ bundler exec jekyll build
C:/Ruby33-x64/bin/jekyll:25: warning: csv was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add csv to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:22: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Configuration file: C:/Users/tjb/Desktop/Web Development/contrast-master/_config.yml
            Source: C:/Users/tjb/Desktop/Web Development/contrast-master
       Destination: C:/Users/tjb/Desktop/Web Development/contrast-master/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
1 │ @import index, font, basic, layout, classes
  │         ^^^^^
  ╵
    C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:9  root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
1 │ @import index, font, basic, layout, classes
  │                ^^^^
  ╵
    C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:16  root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
1 │ @import index, font, basic, layout, classes
  │                      ^^^^^
  ╵
    C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:22  root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
1 │ @import index, font, basic, layout, classes
  │                             ^^^^^^
  ╵
    C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:29  root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
1 │ @import index, font, basic, layout, classes
  │                                     ^^^^^^^
  ╵
    C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:37  root stylesheet
Error: Expected newline.
  ╷
8 │     padding: 1.75em calc(40% - 17em)
  │                                     ^
  ╵
  C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\index.sass 8:37  @import
  C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:9   root stylesheet
  Conversion error: Jekyll::Converters::Sass encountered an error while converting 'assets/css/frame.sass':
                    Expected newline.
                    ------------------------------------------------
      Jekyll 4.3.3   Please append `--trace` to the `build` command
                     for any additional information or backtrace.
                    ------------------------------------------------
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:181:in `rescue in convert': Expected newline. (Jekyll::Converters::Scss::SyntaxError)

          raise SyntaxError, e.message
                ^^^^^^^^^^^^^^^^^^^^^^
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:162:in `convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:105:in `block in convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `reduce'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:84:in `render_document'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:63:in `run'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:572:in `render_regenerated'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:564:in `block in render_pages'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `render_pages'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:211:in `render'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:80:in `process'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby33-x64/bin/jekyll:25:in `load'
        from C:/Ruby33-x64/bin/jekyll:25:in `<main>'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/compiler/host.rb:86:in `compile_request': Expected newline. (Sass::CompileError)
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/compiler.rb:171:in `compile_string'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/embedded.rb:37:in `compile_string'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:163:in `convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:105:in `block in convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `reduce'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `convert'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:84:in `render_document'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:63:in `run'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:572:in `render_regenerated'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:564:in `block in render_pages'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `render_pages'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:211:in `render'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:80:in `process'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby33-x64/bin/jekyll:25:in `load'
        from C:/Ruby33-x64/bin/jekyll:25:in `<main>'

Solution

  • This is a known bug when working with Ruby >= 3.3 and Jekyll < 4.3.3 caused by a compatibility issue with Logger. It was fixed on Jekyll 4.3.3. See the release notes here.

    Note that even though you have a newer version of Jekyll installed in your machine (as indicated when you ran jekyll -v), your project's dependencies show it's using Jekyll 4.2.2 (indicated when you ran bundle install).

    To fix this issue, upgrade jekyll dependency within the project context. If you can upgrade it to the latest version (4.4.1 at the time this answer is written), this is the recommended way to solve the problem:

    bundle update jekyll
    

    Alternatively, if there are any specific reasons blocking you from updating Jekyll to the latest, you want to ensure you update it at least to 4.3.3. To do this, update your Gemfile to specify it:

    gem 'jekyll', '4.3.3'
    

    And run bundle install.