Running any Jekyll command fails to load Jekyll

Every time I run jekyll I get an error telling me to prepend it with bundle exec. Every time I run bundle exec jekyll (e.g. bundle exec jekyll build; bundle exec jekyll serve; etc.), I get a load error:

bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll)
/usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `require': cannot load such file -- rexml/parsers/baseparser (LoadError)

What OS are you on?

Downgrade to Ruby 2.7. Jekyll is not reliable on 3 yet.

In a project, add Jekyll to your Gemfile. Then run bundle config and bundle install.

Your problem is that Jekyll runs but fails because it relies on Kramdown

For Jekyll 3.9, you need to explicitly install a parser.

gem "jekyll", "~> 3.9"
gem "kramdown-parser-gfm", "~> 1.1"

Then bundle install and serve.

If that doesn’t work then see my gist which lets you use a template project or use the bundle exec jekyll new to setup a new project.

I’d say do that and then come back to your current project and make changes.

1 Like

Thank you, I had the same error as the OP and downgrading to 2.7.4 did the trick :handshake: