铁路演员的问题第 190 集
听完 Rails Cast No 190 后,我坐下来尝试一下,
所以我
gem install nokogiri
在我的 Windows 7 Ultimate 笔记本电脑上安装了 nokogiri。我使用 Ruby 1.9
安装 Nokogiri Now 的方式
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...
,这就是我为以下代码
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
hello.rb
我尝试以标题的形式获得结果,但出现以下错误!
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
卸载并重新安装,但仍然无法摆脱该错误。
请帮我解决它!
谢谢
高塔姆
After listening to Rails Cast No 190 I sat down to try it
So I installed nokogiri with
gem install nokogiri
on my Windows 7 Ultimate laptop. I use Ruby 1.9
and this is the way i Installed 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...
Now for the following code 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
I tried to get a result in the form of Title but I am getting the following error!!
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>'
I have tried to uninstall and reinstall with gem uninstall nokogiri
but still i cant get rid of the error.
Please help me to fix it!!
Thanks
Gautam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是 Ruby 1.9.1 的已知问题。使用 Ruby 1.8.7 再次尝试以缩小问题范围。
This appears to be a known issue with Ruby 1.9.1. Try it again with Ruby 1.8.7 to narrow down your problem.
当您安装Nokogiri时,您是否遇到以下问题,您选择了什么选项?
您应该选择 x86-mswin32-60 版本。您似乎安装了非 Windows 版本。
如果您选择了 ruby 选项之一,请尝试
gem uninstall nokogiri
然后再次安装When you installed Nokogiri did you get the following question, and what option did you choose?
You should have chosen the x86-mswin32-60 version. It looks like you have a non-windows version installed.
If you chose one of the ruby options then try
gem uninstall nokogiri
and then install again