From: Francesco Vollero Date: 2010-03-24T23:33:09+09:00 Subject: Re: how to install nokogiri Il 24/03/10 12.04, Pen Ttt ha scritto: > i have installed nokogiri with command: > sudo /usr/local/ruby/bin/gem install nokogiri > but there is another problem i can not solve: > i can run the script on my terminal > require 'nokogiri' > require 'open-uri' > > doc = Nokogiri::HTML(open('http://www.huomo.cn')) > doc.search("//h2/a").each do |link| > puts link.inner_text > puts link[:href] > end > but i can not run it on my netbean ide 6.8 > the ouput is : > /home/pt/NetBeansProjects/test/lib/main.rb:4:in `require': no such file > to load -- nokogiri (LoadError) > from /home/pt/NetBeansProjects/test/lib/main.rb:4 > what can i do now? > Simple, since you've used gem to install nokogiri, you've to add: require 'rubygems' before require 'nokogiri' or ruby -rrubygems script.rb ... But keep a look at this post, http://tomayko.com/writings/require-rubygems-antipattern