Reputation: 75
I'm working on a jekyll site on Ubuntu 15.04 and when i try jekyll serve
(or any other jekyll command, with or without sudo) i receive the following:
/var/lib/gems/2.1.0/gems/jekyll-3.1.2/bin/jekyll:9:in `<top (required)>': undefined method `require_from_bundler' for Jekyll::PluginManager:Class (NoMethodError)
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
I have worked on jekyll sites on this computer recently without this issue, and I'm not certain how the configuration changed to generate this error. I've tried gem uninstall jekyll
and reinstalling it, same issue happens. I'm not a Ruby dev and I'm a bit at a loss for how to troubleshoot this.
Upvotes: 1
Views: 2215
Reputation: 2113
Well, I suggest you to run Jekyll with Bundler, which is an awesome dependency manager. It will make sure you have all the gems you need.
1st. Uninstall Jekyll 2.2.0. This version is too old and requires Python to run some dependencies. Jekyll 3.x does not require Python anymore.
So, run sudo gem uninstall jekyll --version 2.2.0
. (or gem uninstall jekyll -v 2.2.0
)
2nd. Now, install Bundler:
gem install bundler
(or sudo gem install bundler
)
3rd. Add a Gemfile
(don't give it any extension) to your site root with the following content:
source "https://rubygems.org"
gem 'jekyll', '3.1.2'
This will make sure you will have installed Jekyll 3.1.2 and all its dependencies.
If you will deploy your site to GitHub, the Gemfile must be different:
source "https://rubygems.org"
gem 'github-pages'
This will include the Jekyll version running at GitHub pages at the time.
4th. Using the terminal, cd path/to/path
to your site root and run bundle install
there. Bundler will install all the dependencies for you and create a new file called Gemfile.lock
, which will have a list of all dependencies installed for that project.
5th. Run bundle exec jekyll serve
Done!
NOTE 1: I recommend you to use Jekyll 3.0.3, as I think it's better then 3.1.2 (it seems there are some bugs on 3.1.2 which don't have in 3.0.3). Anyway, opinion based tip - it's up to you.
NOTE 2: If you don't have openssl installed to your computer, replace the protocol in your Gemfile:
source "https://rubygems.org"
replace for
source "http://rubygems.org"
For reference:
That's it! Hope to have helped!
Upvotes: 3