jekyll: jekyll install leads to immediate errors

Just starting out with Jekyll. Ruby is up to date. I ran

sudo gem install jekyll

and jekyll installs fine.

But when I run a test command, like, jekyll -v, I get this error:

WARN: Unresolved specs during Gem::Specification.reset:
      listen (< 3.1, ~> 3.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.2/lib/bundler/runtime.rb:317:in `check_for_activated_spec!': You have already activated kramdown 1.14.0, but your Gemfile requires kramdown 1.13.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.2/lib/bundler/runtime.rb:32:in `block in setup'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/forwardable.rb:229:in `each'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/forwardable.rb:229:in `each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.2/lib/bundler/runtime.rb:27:in `map'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.2/lib/bundler/runtime.rb:27:in `setup'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.2/lib/bundler.rb:101:in `setup'
	from /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.5.1/lib/jekyll/plugin_manager.rb:48:in `require_from_bundler'
	from /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.5.1/exe/jekyll:9:in `<top (required)>'
	from /usr/local/bin/jekyll:22:in `load'
	from /usr/local/bin/jekyll:22:in `<main>'

What gives?

Edit: tried bundle exec, gem install bundler, nothing works.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Something that’s not clearly stated in our docs:

Running Jekyll commands with recent versions, is highly dependent on the presence of a Gemfile in the location (directory) from which the commands are called…

  • If the current location contains a Gemfile, always prepend jekyll commands with bundle exec. i.e. bundle exec jekyll -v or bundle exec jekyll serve . Note: This requires Bundler gem to be installed as well.
  • Otherwise, bare commands work just fine.
  • If not, some other things are conflicting with Jekyll. Get more info by append-ing --trace to the command.
  • Running bundle update may help with slightly older releases.

installed with sudo because it didn’t work the way prescribed by the quick-start guide

@ashmaroli in Linux, if you’re not the root user and you’re using the system’s ruby (instead of using version managers like rvm), and you try to run gem install jekyll bundler without sudo, you get this error

ERROR: While executing gem ... (Errno:EACCES) 
    Permission denied - /var/lib/gems

This Stack Overflow question has more details.


@lrdegeest Looking at this part of the error message

You have already activated kramdown 1.14.0, but your Gemfile requires kramdown 1.13.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

It is telling you to add bundle exec in front of all your Jekyll commands. For example, use bundle exec jekyll serve instead of jekyll serve. I get the impression from your post that you seem to be running bundle exec alone by itself. I apologize in advance if I misunderstood your post.

I experienced the exact same issue. Prepending 'bundle exec ’ to each jekyll command (such as bundle exec jekyll serve indeed seems to work. Weird stuff. It’s voodoo, I guess.

change kramdown (1.13.2) in the gemlock file to kramdown (1.14.0).

Don’t do this. It may lead to other bugs. The proper way is to just run bundle update

Do https://jekyllrb.com/docs/troubleshooting/#installation-problems needs to be updated?

I’m no Linux user but @jekyll/documentation would certainly appreciate a contribution here.