Uninitialized constant Liquid::Expression::MethodLiteral

Hi, I followed the instructions from Quickstart | Jekyll • Simple, blog-aware, static sites, but upon issuing bundle exec jekyll serve I get the following stacktrace thrown at me:

Liquid Exception: uninitialized constant Liquid::Expression::MethodLiteral in /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/minima-2.5.1/_layouts/default.html
                    ------------------------------------------------
      Jekyll 4.2.2   Please append `--trace` to the `serve` command 
                     for any additional information or backtrace. 
                    ------------------------------------------------
/usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/filters.rb:407:in `compare_property_vs_target': uninitialized constant Liquid::Expression::MethodLiteral (NameError)
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/filters.rb:199:in `block in where'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/filters.rb:198:in `select'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/filters.rb:198:in `where'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/strainer_template.rb:48:in `invoke'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/context.rb:100:in `invoke'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/variable.rb:90:in `block in render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/variable.rb:88:in `each'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/variable.rb:88:in `render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/assign.rb:33:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:80:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:230:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/for.rb:180:in `block (2 levels) in render_segment'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/for.rb:178:in `each'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/for.rb:178:in `block in render_segment'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/context.rb:130:in `stack'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/for.rb:170:in `render_segment'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/for.rb:88:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:80:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:230:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/if.rb:58:in `block in render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/if.rb:52:in `each'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tags/if.rb:52:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:80:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:230:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/document.rb:41:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/template.rb:195:in `render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/template.rb:205:in `render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.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.2.2/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.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.2.2/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/inclusion.rb:16:in `render'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/tags/include.rb:208:in `block in render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/context.rb:130:in `stack'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/tags/include.rb:206:in `render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/tag.rb:51:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:80:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:230:in `render_node'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/document.rb:41:in `render_to_output_buffer'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/template.rb:195:in `render'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/liquid-5.3.0/lib/liquid/template.rb:205:in `render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.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.2.2/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.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.2.2/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:131:in `render_liquid'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:194:in `render_layout'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:163:in `place_in_layouts'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:93:in `render_document'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:63:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:547:in `render_regenerated'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:532:in `block (2 levels) in render_docs'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:531:in `each'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:531:in `block in render_docs'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:530:in `each_value'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:530:in `render_docs'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:210:in `render'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:80:in `process'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:28:in `process_site'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:65:in `build'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:36:in `process'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	from /usr/lib/ruby/gems/3.0.0/gems/jekyll-4.2.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.2.2/exe/jekyll:15:in `<top (required)>'
	from /usr/bin/jekyll:25:in `load'
	from /usr/bin/jekyll:25:in `<top (required)>'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:58:in `load'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli/exec.rb:23:in `run'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli.rb:483:in `exec'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli.rb:31:in `dispatch'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/cli.rb:25:in `start'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/exe/bundle:48:in `block in <top (required)>'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/gems/bundler-2.3.10/exe/bundle:36:in `<top (required)>'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/bin/bundle:25:in `load'
	from /home/grzesiek/.local/share/gem/ruby/3.0.0/bin/bundle:25:in `<main>'

My ruby version is ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux].

Could you help me resolve this issue?

I don’t think jekyll will work with liquid 5? not sure how you would get it installed though.

It kind of looks like you have ruby installed twice? once in usr/bin and again in home/ ?

If you aren’t using ruby for anything else I think I would uninstall it and re-install it and see what happens.

1 Like

So I’ve repeated all the steps carefully and fixed the problem.

Previously I didn’t run gem install jekyll, so my ruby used a system-installed jekyll, which seems to have caused problems.