听完 Rails Cast No 190 我坐下来试了一下
所以我安装了 nokogiri
gem install nokogiri
在我的 Windows 7 Ultimate 笔记本电脑上。我使用 Ruby 1.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
但我仍然无法摆脱错误。
请帮我解决它!
谢谢
高塔姆