abalabazn
abalabazn

Reputation: 351

Jekyll/Ruby Kramdown Missing Dependency

I am struggling with trying to set up my first jekyll blog. I am trying to run jekyll server, but upon typing it into the terminal I get the error message:

You are missing a library required for Markdown. Please run:
$ [sudo] gem install kramdown
Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2013-08-15-immunize-canada-app.md/#excerpt':
                Missing dependency: kramdown
         ERROR: YOUR SITE COULD NOT BE BUILT:
                ------------------------------------
                Missing dependency: kramdown

I have already installed kramdown as it asks, but still receive this error. I found on another post to add gem 'kramdown' to the Gemfile, which still doesn't work. I am super new to Ruby/Jekyll, so any help would be very appreciated!

Upvotes: 17

Views: 7121

Answers (5)

Clauz
Clauz

Reputation: 31

I encountered the same problem under OS X Yosemite, you should check your Ruby environment, see if bundle install command install your gems to the right place.

which ruby
which gem
which jekyll
bundle show jekyll

You may find that you are not calling the right jekyll you wanted to.


My solution:

brew uninstall ruby (I installed ruby with HomeBrew) brew install rbenv ruby-build (Use rbenv to manage system Ruby reference) echo 'eval "$(rbenv init -)"' >> ~/.bash_profile (or ~/.zshrc)

restart your shell

rbenv install 2.2.2 (Install Ruby v2.2.2) rbenv global 2.2.2 (Make v2.2.2 the global default) rbenv versions (Double check the output, whether the default is not system one)

Upvotes: 0

Dyno Fu
Dyno Fu

Reputation: 9044

I think the problem is

gem query | grep kramdown
kramdown (1.8.0, 1.5.0)

bundle show kramdown
/Library/Ruby/Gems/2.0.0/gems/kramdown-1.5.0

as suggested in http://bundler.io/, always use bundle exec

bundle exec jekyll serve --watch 

In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle. However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.

Upvotes: 47

MewX
MewX

Reputation: 4312

I solved the same problem in my environment:

$>gem uninstall kramdown

Select gem to uninstall:
 1. kramdown-1.5.0
 2. kramdown-1.9.0
 3. All versions
> 3

You have requested to uninstall the gem:
        kramdown-1.5.0

github-pages-39 depends on kramdown (= 1.5.0)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled kramdown-1.5.0

You have requested to uninstall the gem:
        kramdown-1.9.0

jekyll-3.0.1 depends on kramdown (~> 1.3)
jekyll-2.4.0 depends on kramdown (~> 1.3)
markdown-1.2.0 depends on kramdown (>= 1.5.0)
test-unit-3.1.5 depends on kramdown (>= 0, development)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Remove executables:
        kramdown

in addition to the gem? [Yn]  y
Removing kramdown
Successfully uninstalled kramdown-1.9.0

$>gem install kramdown
Fetching: kramdown-1.9.0.gem (100%)
Successfully installed kramdown-1.9.0
Parsing documentation for kramdown-1.9.0
Installing ri documentation for kramdown-1.9.0
Done installing documentation for kramdown after 2 seconds
1 gem installed

The problem is caused by 2 versions of kramdown.

So uninstall it first, then re-install it.

Hope this helps.

Upvotes: 2

Fatih Hayrioğlu
Fatih Hayrioğlu

Reputation: 3496

Delete Gemfile.lock

bundle install

run jekyll

Upvotes: 3

mcku
mcku

Reputation: 1443

This is most likely due to multiple installed jekyll gems. Jekyll can be installed multiple times because one may have

  1. installed it by gem install jekyll on first try
  2. added github-pages dependency in Gemfile as suggested by the guides

Therefore you should check if there are multiple installed copies. Run gem list jekyll from the shell, which outputs the following:

$ gem list jekyll

*** LOCAL GEMS ***

jekyll (2.5.3, 2.4.0)
jekyll-coffeescript (1.0.1)
jekyll-feed (0.3.1)
jekyll-gist (1.3.4, 1.2.1)
...

As you see, 2.5.3 and 2.4.0 are installed. I am running gem uninstallto get rid of one. The old version is a dependency of github-pages, therefore just uninstall jekyll-2.5.3.

$ gem uninstall jekyll

Select gem to uninstall:
 1. jekyll-2.4.0
 2. jekyll-2.5.3
 3. All versions
> 2
Successfully uninstalled jekyll-2.5.3

I have also uninstalled jekyll-gist the same way. This way you don't need to uninstall ruby at all.

Upvotes: 12

Related Questions