Nokogiri installed but not found when using nanoc

436 Views Asked by At

I'm having a problem with a project using bundler and rbenv:

I'm in my projects root dir and enter

bundle install

which installs all bundles according to my Gemfile:

source 'http://rubygems.org'

gem 'rake', '~> 0.9.2'
gem 'nanoc', '~> 3.2.4'
gem 'sass', '~> 3.1.15'
gem 'coderay', '~> 1.0.5'
gem 'nokogiri', '~> 1.4.4'
gem 'yajl-ruby', '~> 0.8.2'
gem 'pygmentize', '~> 0.0.3'
gem 'coderay', '~> 1.0.5'
gem 'fssm', '~>0.2.9'
gem 'coderay_bash', '~>1.0.2'
gem 'kramdown', '~> 0.13.2'
gem 'htmlentities', '~> 4.3.1'

This also claims to install nokogiri. But whenever I run

nanoc compile

I get an error message saying:

LoadError: cannot load such file -- nokogiri
Try installing the 'nokogiri' gem (`gem install nokogiri`) and then re-running the command.

I already tried uninstalling the gem with gem uninstall nokogiri and running the whole thing again, but nothing worked so far.

2

There are 2 best solutions below

1
On

This is quite strange. From what I can tell, your setup looks correct. I don’t see a solution immediately, but perhaps removing the Gemfile.lock and re-running “bundle install” may do the trick.

Update: Do you have multiple nanoc versions installed? It might be that the nanoc version that you are using (because it is first in $PATH) is not the one installed by the gem from rbenv. Does switching to system ruby, uninstalling the nanoc gem, and then switching back to your rbenv ruby fix nanoc?

0
On

I had a similar problem with compiling the developer.github nonoc pages. My problem was that I changed the ruby version in the Gemfile. Then yajl was not found when I did nanoc compile. My solution to problem was to remove all versions specified after dependencies in the Gemfile and then do:

bundle update

Whith the new versions of yajl, nokogiri etc I was able to run nanoc compile without problems.