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开发者_JAVA技巧 file to load
message.
My Ruby version is 1.8.7 if I type ruby --version
in the terminal.
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.
精彩评论