Tejaswi Yerukalapudi
Tejaswi Yerukalapudi

Reputation: 9157

require nokogiri: Load Error

I'm new to Ruby and I was looking around for libraries to parse html and found Nokogiri. The problem I'm having is if I fire up IRB and type require 'nokogiri', it works fine and prints out true. But if I include that as a part of my .rb file and execute it with ruby <scriptname>, it gives me a LoadError: no such file to load message.

My Ruby version is 1.8.7 if I type ruby --version in the terminal.

Upvotes: 2

Views: 1315

Answers (1)

Kassym Dorsel
Kassym Dorsel

Reputation: 4843

Try adding

require 'rubygems'

to the .rb file.

In Ruby 1.9+ rubygem is loaded automatically and not needed. Although there is debate whether that line is required pre 1.9.

Nevertheless, give it a shot.

Upvotes: 4

Related Questions