You are not logged in.
I have a problem using "nokogiri" package after its installed.
Ruby v2.0.0p247
gem v2.0.3
gem list
*** LOCAL GEMS ***
bigdecimal (1.2.0)
bundler (1.3.5)
charlock_holmes (0.6.9.4)
io-console (0.4.2)
json (1.7.7)
mini_portile (0.5.2)
minitest (4.3.2)
nokogiri (1.6.0)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
test-unit (2.0.0.0)
This is example code I'm trying to use from tutorial > http://ruby.bastardsbook.com/chapters/html-parsing/
#!/usr/bin/ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
page = Nokogiri::HTML(open('http://en.wikipedia.org/wiki/HTML'))
page.css('div#content div#bodyContent table.infobox tr th').each do |el|
puts el.text
endThis is error I see in terminal:
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- nokogiri (LoadError)
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ./scrape.rb:4:in `<main>'Also have this warning when I run script using sudo:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
Last edited by TuxLyn (2013-11-10 07:52:03)
::: Using Arch Linux Since October 25, 2011 :::
::: Tutorials: http://distrogeeks.com/ :::
Offline
Alright it looks like the problem was because I've installed this gem as root :-)
I fixed this by running this two commands;
as root I run this command;
# gem uninstall nokogiri
and as regular user I run;
$ gem install nokogiri
I only see warning now > WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
::: Using Arch Linux Since October 25, 2011 :::
::: Tutorials: http://distrogeeks.com/ :::
Offline
I've set -W0 to ignore warning ^_^ My first ruby script works ![]()
::: Using Arch Linux Since October 25, 2011 :::
::: Tutorials: http://distrogeeks.com/ :::
Offline