2

I am trying to learn Jekyll and if I enter the following command

rake post title="Hello World"

I get the following error:

rake post title="My First Post"
/usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 11 total gem(s) (Gem::LoadError)
    from /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:307:in `to_spec'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /usr/bin/rake:18

Here is my ENV:

gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.3
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib64/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib64/ruby/gems/1.8
     - /home/jsmith/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
SJS
  • 5,607
  • 19
  • 78
  • 105

1 Answers1

2

Firstly, to simplify things, your Jekyll app should be using bundler*. cd to your app and run:

$ bundle init

This creates a Gemfile. In that Gemfile add jekyll:

# Gemfile
source 'https://rubygems.org'
gem 'jekyll'

Then run bundle install, which will install jekyll and all its dependencies:

$ bundle install

Then run rake with bundle exec beforehand, as in:

$ bundle exec rake post title="Hello World"

What this does is use the version of rake that's added to the Gemfile (the list of gems that is associated with your current project).

* Instructions taken from http://matthodan.com/2012/10/27/how-to-create-a-blog-with-jekyll.html

Jon Cairns
  • 11,783
  • 4
  • 39
  • 66