Freshly installed jekyll gives weird error

Hi, I installed jekyll and things seemed to work. I started to configure it to my needs and then suddenly I got the error below. Ever since I have not been able to get rid of this error. I did a complete reinstall of jekyll and bundle and all local gems, created a new projects from scratch, but nothing helps.

Can someone please help me debug what is wrong?

I create a new directory:

jekyll new docs2
cd docs2

And then run:

daniel:~/projects/aicxx/linuxviewer/linuxviewer/docs2>bundle exec jekyll serve --trace
Configuration file: /home/carlo/projects/aicxx/linuxviewer/linuxviewer/docs2/_config.yml
            Source: /home/carlo/projects/aicxx/linuxviewer/linuxviewer/docs2
       Destination: /home/carlo/projects/aicxx/linuxviewer/linuxviewer/docs2/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
  Liquid Exception: undefined method `each' for #<Liquid::Registers:0x00005590e3a42008 @static={:cached_partials=>{}, :file_system=>#<Liquid::BlankFileSystem:0x00005590e1ddac08>, :template_factory=>#<Liquid::TemplateFactory:0x00005590e3a41e78>, :site=>#<Jekyll::Site @source=/home/carlo/projects/aicxx/linuxviewer/linuxviewer/docs2>, :page=>{ "tags": [ ], "excerpt": "<p>You’ll find this post in your <code class=\"language-plaintext highlighter-rouge\">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class=\"language-plaintext highlighter-rouge\">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>\n", "path": "_posts/2023-03-26-welcome-to-jekyll.markdown", "title": "Welcome to Jekyll!", "id": "/jekyll/update/2023/03/26/welcome-to-jekyll", "content": "<p>You’ll find this post in your <code class=\"language-plaintext highlighter-rouge\">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class=\"language-plaintext highlighter-rouge\">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>\n\n<p>Jekyll requires blog post files to be named according to the following format:</p>\n\n<p><code class=\"language-plaintext highlighter-rouge\">YEAR-MONTH-DAY-title.MARKUP</code></p>\n\n<p>Where <code class=\"language-plaintext highlighter-rouge\">YEAR</code> is a four-digit number, <code class=\"language-plaintext highlighter-rouge\">MONTH</code> and <code class=\"language-plaintext highlighter-rouge\">DAY</code> are both two-digit numbers, and <code class=\"language-plaintext highlighter-rouge\">MARKUP</code> is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>\n\n<p>Jekyll also offers powerful support for code snippets:</p>\n\n<figure class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\"><span class=\"k\">def</span> <span class=\"nf\">print_hi</span><span class=\"p\">(</span><span class=\"nb\">name</span><span class=\"p\">)</span>\n <span class=\"nb\">puts</span> <span class=\"s2\">\"Hi, </span><span class=\"si\">#{</span><span class=\"nb\">name</span><span class=\"si\">}</span><span class=\"s2\">\"</span>\n<span class=\"k\">end</span>\n<span class=\"n\">print_hi</span><span class=\"p\">(</span><span class=\"s1\">'Tom'</span><span class=\"p\">)</span>\n<span class=\"c1\">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>\n\n<p>Check out the <a href=\"https://jekyllrb.com/docs/home\">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href=\"https://github.com/jekyll/jekyll\">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href=\"https://talk.jekyllrb.com/\">Jekyll Talk</a>.</p>\n\n", "categories": [ "jekyll", "update" ], "output": null, "date": "2023-03-26 22:48:54 +0200", "previous": null, "url": "/jekyll/update/2023/03/26/welcome-to-jekyll.html", "collection": "posts", "next": null, "relative_path": "_posts/2023-03-26-welcome-to-jekyll.markdown", "name": "2023-03-26-welcome-to-jekyll.markdown", "draft": false, "layout": "post", "slug": "welcome-to-jekyll", "ext": ".markdown" }}, @changes={}> in /usr/lib/ruby/gems/3.0.0/gems/minima-2.5.1/_layouts/default.html
bundler: failed to load command: jekyll (/usr/bin/jekyll)
/home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:176:in `render': undefined method `each' for #<Liquid::Registers:0x00005590e3a42008 @static={:cached_partials=>{}, :file_system=>#<Liquid::BlankFileSystem:0x00005590e1ddac08>, :template_factory=>#<Liquid::TemplateFactory:0x00005590e3a41e78>, :site=>#<Jekyll::Site @source=/home/carlo/projects/aicxx/linuxviewer/linuxviewer/docs2>, :page=>{ (NoMethodError)
  "tags": [

  ],
  "excerpt": "<p>You’ll find this post in your <code class=\\"language-plaintext highlighter-rouge\\">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class=\\"language-plaintext highlighter-rouge\\">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>\\n",
  "path": "_posts/2023-03-26-welcome-to-jekyll.markdown",
  "title": "Welcome to Jekyll!",
  "id": "/jekyll/update/2023/03/26/welcome-to-jekyll",
  "content": "<p>You’ll find this post in your <code class=\\"language-plaintext highlighter-rouge\\">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class=\\"language-plaintext highlighter-rouge\\">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>\\n\\n<p>Jekyll requires blog post files to be named according to the following format:</p>\\n\\n<p><code class=\\"language-plaintext highlighter-rouge\\">YEAR-MONTH-DAY-title.MARKUP</code></p>\\n\\n<p>Where <code class=\\"language-plaintext highlighter-rouge\\">YEAR</code> is a four-digit number, <code class=\\"language-plaintext highlighter-rouge\\">MONTH</code> and <code class=\\"language-plaintext highlighter-rouge\\">DAY</code> are both two-digit numbers, and <code class=\\"language-plaintext highlighter-rouge\\">MARKUP</code> is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>\\n\\n<p>Jekyll also offers powerful support for code snippets:</p>\\n\\n<figure class=\\"highlight\\"><pre><code class=\\"language-ruby\\" data-lang=\\"ruby\\"><span class=\\"k\\">def</span> <span class=\\"nf\\">print_hi</span><span class=\\"p\\">(</span><span class=\\"nb\\">name</span><span class=\\"p\\">)</span>\\n  <span class=\\"nb\\">puts</span> <span class=\\"s2\\">\\"Hi, </span><span class=\\"si\\">#{</span><span class=\\"nb\\">name</span><span class=\\"si\\">}</span><span class=\\"s2\\">\\"</span>\\n<span class=\\"k\\">end</span>\\n<span class=\\"n\\">print_hi</span><span class=\\"p\\">(</span><span class=\\"s1\\">'Tom'</span><span class=\\"p\\">)</span>\\n<span class=\\"c1\\">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>\\n\\n<p>Check out the <a href=\\"https://jekyllrb.com/docs/home\\">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href=\\"https://github.com/jekyll/jekyll\\">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href=\\"https://talk.jekyllrb.com/\\">Jekyll Talk</a>.</p>\\n\\n",
  "categories": [
    "jekyll",
    "update"
  ],
  "output": null,
  "date": "2023-03-26 22:48:54 +0200",
  "previous": null,
  "url": "/jekyll/update/2023/03/26/welcome-to-jekyll.html",
  "collection": "posts",
  "next": null,
  "relative_path": "_posts/2023-03-26-welcome-to-jekyll.markdown",
  "name": "2023-03-26-welcome-to-jekyll.markdown",
  "draft": false,
  "layout": "post",
  "slug": "welcome-to-jekyll",
  "ext": ".markdown"
}}, @changes={}>
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:204:in `render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-seo-tag-2.8.0/lib/jekyll-seo-tag.rb:36:in `render'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/tag.rb:51:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:80:in `render_node'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:230:in `render_node'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/document.rb:41:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:194:in `render'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:204:in `render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/inclusion.rb:16:in `render'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/tags/include.rb:208:in `block in render'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/context.rb:134:in `stack'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/tags/include.rb:206:in `render'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/tag.rb:51:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:80:in `render_node'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:230:in `render_node'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/document.rb:41:in `render_to_output_buffer'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:194:in `render'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/liquid-5.4.0/lib/liquid/template.rb:204:in `render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:129:in `render_liquid'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:192:in `render_layout'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:161:in `place_in_layouts'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:93:in `render_document'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:63:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:572:in `render_regenerated'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:557:in `block (2 levels) in render_docs'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:556:in `each'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:556:in `block in render_docs'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:555:in `each_value'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:555:in `render_docs'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:210:in `render'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:80:in `process'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/command.rb:28:in `process_site'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/commands/build.rb:65:in `build'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/commands/build.rb:36:in `process'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/command.rb:91:in `each'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        from /usr/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from /usr/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from /usr/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from /usr/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from /usr/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.3.2/exe/jekyll:15:in `<top (required)>'
        from /usr/bin/jekyll:25:in `load'
        from /usr/bin/jekyll:25:in `<top (required)>'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli/exec.rb:58:in `load'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli/exec.rb:23:in `run'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli.rb:492:in `exec'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli.rb:34:in `dispatch'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/cli.rb:28:in `start'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/exe/bundle:45:in `block in <top (required)>'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /home/carlo/.local/share/gem/ruby/3.0.0/gems/bundler-2.4.9/exe/bundle:33:in `<top (required)>'
        from /home/carlo/.local/share/gem/ruby/3.0.0/bin/bundle:25:in `load'
        from /home/carlo/.local/share/gem/ruby/3.0.0/bin/bundle:25:in `<main>'

it kinda looks like you have ruby stuff in 2 different places. Try uninstalling ruby and then re-install it.

Can you tell me which those two places are? I never used ruby before imho, nor jekyll or bundle or anything :/. So I have no idea how to even “reinstall”. That is, I believe something was already installed when I tried to install jekyll yesterday. When running bundle install I did get an error about not having permission to write to /usr/share/something I think, owned by root. This should be normal though: I am using Arch linux and that also installs gems system wide (using pacman). I found on the arch wiki (I think it was) that I had to set the environment variable GEM_HOME using:

export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"

which I added to my ~/.bashrc now.
That sets GEM_HOME to /home/carlo/.local/share/gem/ruby/3.0.0

I tried to get help (and it helped with a lot of things correctly) from GPT-4, although I am very aware that chatgpt and GPT-4 too at times can say completely wrong things with confidence; I always verify the suggested things. Nevertheless, that has led me to attempt a reinstall as follows:

rm -rf docs # The jekyll project directory.
rm -rf ../linuxviewer-objdir # The build directory of my project, which included the `_site` and jekyll cache.
yay -R jekyll # It was GPT-4 in the first place who told me to use yay for jekyll on Arch (I have installed yay freshly too, yesterday). This removes jekyll.
gem uninstall bundler # Get rid of the installed bundler.
rm -rf ~/.local/share/gem/ruby/3.0.0 # Remove all local gems (see GEM_HOME above).
yay -S jekyll # Reinstall jekyll
gem install bundler # Reinstall bundler
jekyll new docs # Recreate the jekyll project directory

At this point I did STILL get the same error (see above).
But then I did:

bundle install

I guess I had forgotten that…
The error now changed, and required me to do:

bundle add webrick

(A solution found on https://github.com/jekyll/jekyll/issues/8523 by Googling for that error).
After that, bundle exec jekyll serve worked again. Then I made the changes that I had made before to _config.yml, being:

...
destination: /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir/linuxviewer-docs
cache_dir: .generated/jekyll-cache
...
exclude:
    - build-jekyll.sh
    - CMakeLists.txt
    - Gemfile
    - Gemfile.lock

Strangely enough, no .generated/jekyll-cache is created. Also no .jekyll-cache before the above change for that matter. From the generated .gitignore I understand that it might generate:

.sass-cache
.jekyll-cache
.jekyll-metadata

I want to change the path of all of those to either outside the source tree (into my build directory at /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir) or if that is not possible, and for some reason it isn’t for the cache, into .generated/something).

those 2 paths both have a gens folder and I think that is an issue - but not positive.

Sounds like you got it to work - GPT is an interesting option.

Not sure about changing the path to those files.

I am pretty sure that is normal. Certain packages are installed with pacman or yay (from the AUR) and those end up in /usr/lib/ruby/gems/3.0.0/gems. It tried to reinstall everything however and then discovered that:

/usr/lib/ruby/gems/3.0.0/gems/webrick-1.7.0
/usr/lib/ruby/gems/3.0.0/gems/minima-2.5.1
/usr/lib/ruby/gems/3.0.0/gems/jekyll-feed-0.16.0
/usr/lib/ruby/gems/3.0.0/gems/jekyll-seo-tag-2.8.0

where not owned by any package, which prompted me to delete them (assuming a reinstall of jekyll would reinstall if needed). That, however, did not happen.
Moreover, when running bundle install after reinstalling, I got the error:
Bundler::GemNotFound: Could not find jekyll-seo-tag-2.8.0.gem for installation
and had to manually install that gem. After which I got:
Bundler::GemNotFound: Could not find minima-2.5.1.gem for installation
Which I also had to install manually before thing started to work again.
This looks like the webrick thing: as if jekyll-seo-tag and minima are no longer included with jekyll 3.0.0, but they were never cleaned up and still on my harddisk? In the end I installed them both using yay:

yay --rebuildall ruby-jekyll-seo-tag ruby-minima