Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Require Nokogiri? No such file to load

I'm trying to get started with using Nokogiri. I ran the command

gem install nokogiri

as an administrator in Windows 7 (64-Bit). The console said "successfully installed" and "1 gem installed".

When I type in

gem list --local OR gem q --local

I see Nokogiri on the list of "Local Gems".

However, when I try to use it via the require statement (in NetBeans), I get an error that there is "no such file to load".

What am I doing wrong? I'm not a Ruby professional. This is also the first gem I've installed. Please dumb it down for me.

like image 221
Derek Avatar asked Mar 31 '11 06:03

Derek


1 Answers

With Ruby 1.8, you have to require 'rubygems' before requiring any libraries installed as gems. With Ruby 1.9, that is not necessary anymore.

require 'rubygems'
require 'nokogiri'
...
like image 106
Martin Vidner Avatar answered Sep 21 '22 01:09

Martin Vidner