argument error “Option name hard_wrap is already used”

When I try and run bundle exec jekyll serve, I get the error:

  • Conversion error: Jekyll::Converters::Markdown encountered an error while converting. Option name hard_wrap is already used.
  • /.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kramdown-2.3.0/lib/kramdown/options.rb:52:in `define’: Option name hard_wrap is already used (ArgumentError)

I made sure to update to the latest version of Jekyll (4.2.0) and I have kramdown-parser-gfm in my gemfile.

Any help is greatly appreciated.

I don’t think you need to add kramdown-parser-gfm to the Gemfile, because Jekyll automatically includes it as a dependency. You might try removing it, and rebuild Gemfile.lock (i.e. delete it and run bundle install).

Indeed you only need the parser in Gemfile for Jekyll 3.9. Not for 3.8 or 4.x

So you can try remove that from Gemfile, delete project gems and Gemfile.lock and do a clean install.

I am not familiar with rbenv but maybe Kramdown is in that env for a reason outside the current project and that is conflicting?

Also you can try and see if your markdown content is the issue. Like if you delete all your pages or make them blank aside from index.md, do you still get the error.

If you can run jekyll serve --trace can you see which line in your project is causing the error?

Or run with --verbose to see more on what Jekyll is doing at the point the error happens.