Error in building site (bundle? rake?)


#1

HI.
n00b here.
I’m hoping I’m posting this in the proper thread.

I’m successfully building the vanilla jekyçç by typing

jekyll new my-awesome-site

If I try to install Hanuman I end up having to different errors.

If I clone repository and try to build it I have this:

/var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound)
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/exe/jekyll:11:in `<top (required)>'
        from /usr/local/bin/jekyll:22:in `load'
        from /usr/local/bin/jekyll:22:in `<main>'

While If I add the gems manually I have this error

/var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:313:in `check_for_activated_spec!': You have already activated i18n 1.0.1, but your Gemfile requires i18n 0.9.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:31:in `block in setup'
        from /usr/lib/ruby/2.3.0/forwardable.rb:204:in `each'
        from /usr/lib/ruby/2.3.0/forwardable.rb:204:in `each'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:26:in `map'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:26:in `setup'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/exe/jekyll:11:in `<top (required)>'
        from /usr/local/bin/jekyll:22:in `load'
        from /usr/local/bin/jekyll:22:in `<main>'
root@LAPTOP-PCDRUMS:/mnt/d/Pedro Carrilho/Jekyll/test# ruby -v
ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux-gnu]

Ruby version: ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux-gnu]

Interesting: if I run:
```jekyll -v````
I have this back:

jekyll -v
/var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound)
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
        from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
        from /var/lib/gems/2.3.0/gems/jekyll-3.8.1/exe/jekyll:11:in `<top (required)>'
        from /usr/local/bin/jekyll:22:in `load'
        from /usr/local/bin/jekyll:22:in `<main>'

While if I install it ot says everything went fine

gem install jekyll bundler
Successfully installed jekyll-3.8.1
Parsing documentation for jekyll-3.8.1
Done installing documentation for jekyll after 1 seconds
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Done installing documentation for bundler after 4 seconds
2 gems installed

Any help


#2
  1. You don’t need to run jekyll new if you plan to use a specific theme
  2. Run bundle install once you’ve cloned the GitHub repo of the theme to install all dependencies
  3. Always prepend your command with bundle exec inside the projet, e.g. bundle exec jekyll serve

This project has a Rakefile, it means you can run pre-configured tasks instead of typing native commands.
type bundle exec rake -T to list all available tasks

so here you can type bundle exec rake site:serve instead of bundle exec jekyll serve

Don’t confuse a global jekyll install (gem install jekyll) and a local jekyll install (bundle install):

  • gem install jekyll will install latest jekyll version
  • bundle install wiil install all dependencies declared in the Gemfile of your project. Here for instance, it will install jekyll, but also rake and the jekyll-paginate plugin.

Note that this particular Gemfile could be simplified, as you don’t need to declare jekyll if you are using the github-pages gem.

I hope this gives you a better understanding of using bundler in Jekyll projects.