Rails Cast No 190を聞いた後、座って試してみました
だから私はnokogiriをインストールしました
gem install nokogiri
私のWindows 7 Ultimateラップトップで。私はRuby1.9を使用しています
これが私が Nokogiri をインストールした方法です
C:\Ruby>gem install nokogiri
Successfully installed nokogiri-1.4.2-x86-mingw32
1 gem installed
Installing ri documentation for nokogiri-1.4.2-x86-mingw32...
Updating class cache with 1221 classes...
Installing RDoc documentation for nokogiri-1.4.2-x86-mingw32...
次のコードについてhello.rb
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = "http://timesofindia.indiatimes.com/rssfeeds/-2128838597.cms"
doc = Nokogiri::HTML(open(url))
puts doc.at_css("title").text
タイトルの形で結果を取得しようとしましたが、次のエラーが発生しています!!
C:\Ruby>ruby hello.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri/nokogir
i.rb:1:in `require': 127: The specified procedure could not be found. - Init_n
okogiri (LoadError)
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nokogiri/1.9/nok
ogiri.so
from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nok
ogiri/nokogiri.rb:1:in `<top (required)>'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nok
ogiri.rb:13:in `require'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2-x86-mingw32/lib/nok
ogiri.rb:13:in `<top (required)>'
from hello.rb:2:in `require'
from hello.rb:2:in `<main>'
アンインストールして再インストールしようとしましgem uninstall nokogiri
たが、それでもエラーを取り除くことができません。
それを修正するのを手伝ってください!!
ありがとう
ゴータム