linjer / jekyll-katex

[DEPRECATED] Jekyll plugin for easy server-side math rendering via KaTeX
MIT License
96 stars 8 forks source link

Error loading plugin when katex configuration options are not specified in _config.yml #3

Closed gvgramazio closed 6 years ago

gvgramazio commented 6 years ago

Probably I'm simply too dumb to follow your guide. These are the steps that I did so far:

  1. Added the plugin in my _config.yml. This is what I have now:
    plugins:
      - jekyll-feed
      - jekyll-katex
  2. Added the plugin in my Gemfile plugin block. This is what I have:
    group :jekyll_plugins do
      gem "jekyll-feed", "~> 0.6"
      gem 'jekyll-katex', "~> 0.2"
    end
  3. I run bundle install
  4. I run bundle exec jekyll serve and had a long error output:

    bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
    Bundler::GemRequireError: There was an error while trying to load the gem 'jekyll-katex'.
    Gem Load Error is: undefined method `[]' for nil:NilClass
    Backtrace for gem load error is:
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex/configuration.rb:22:in `js_path'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:14:in `<class:Katex>'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:12:in `<module:Tags>'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:7:in `<module:Jekyll>'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:6:in `<top (required)>'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex.rb:7:in `require'
    /var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex.rb:7:in `<top (required)>'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:81:in `require'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:81:in `block (2 levels) in require'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
    /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
    /usr/local/lib/site_ruby/2.5.0/bundler.rb:114:in `require'
    /var/lib/gems/2.5.0/gems/jekyll-3.8.3/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
    /var/lib/gems/2.5.0/gems/jekyll-3.8.3/exe/jekyll:11:in `<top (required)>'
    /usr/local/bin/jekyll:23:in `load'
    /usr/local/bin/jekyll:23:in `<top (required)>'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:424:in `exec'
    /usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    /usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
    /usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch'
    /usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
    /usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:18:in `start'
    /usr/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
    /usr/local/lib/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
    /usr/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
    /usr/local/bin/bundle:23:in `load'
    /usr/local/bin/bundle:23:in `<main>'
    Bundler Error Backtrace:
    
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:84:in `rescue in block (2 levels) in require'
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:80:in `block (2 levels) in require'
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
      /usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
      /usr/local/lib/site_ruby/2.5.0/bundler.rb:114:in `require'
      /var/lib/gems/2.5.0/gems/jekyll-3.8.3/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
      /var/lib/gems/2.5.0/gems/jekyll-3.8.3/exe/jekyll:11:in `<top (required)>'
      /usr/local/bin/jekyll:23:in `load'
      /usr/local/bin/jekyll:23:in `<top (required)>'

    Note that if I didn't step 2, then the error is the same. If instead I didn't step 3, then the error is:

    Dependency Error: Yikes! It looks like you don't have jekyll-katex or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-katex' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 
    jekyll 3.8.3 | Error:  jekyll-katex

Any help is appreciated.

linjer commented 6 years ago

@gvgramazio This is a bug. It is due to me adding the new configuration options and it appears to fail if none are provided (which is a case that should be supported). I'll try to fix this over the weekend.

For now, I believe a workaround should be to add configuration options to your _config.yml. I think it might be sufficient to add

katex:

with no other fields, but let me know if I'm wrong. Sorry about that.

linjer commented 6 years ago

Should be fixed in version 0.2.1