我已经在我需要的Ruby lib
文件中安装了nokogiri
,如下所示:
C:Ruby193>gem list
*** LOCAL GEMS ***
addressable (2.3.2)
bigdecimal (1.1.0)
builder (3.1.4)
bundler (1.2.3)
childprocess (0.3.6)
domain_name (0.5.7)
ffi (1.3.1 x86-mingw32)
git (1.2.5)
hoe (3.4.1)
httpclient (2.3.2)
io-console (0.3)
jar_wrapper (0.1.2)
jeweler (1.8.4)
json (1.5.4)
libwebsocket (0.1.7.1)
mechanize (2.5.1)
mechanize-downloader (0.0.1)
mime-types (1.19)
mini_magick (3.2.1)
minitest (2.5.1)
multi_json (1.5.0)
net-http-digest_auth (1.2.1)
net-http-persistent (2.8)
nokogiri (1.5.6 x86-mingw32)
ntlm-http (0.1.1)
progressbar (0.12.0)
rake (0.9.2.2)
rautomation (0.7.3)
rdoc (3.9.4)
rubyzip (0.9.9)
s4t-utils (1.0.4)
selenium (0.2.5)
selenium-webdriver (2.27.2)
subexec (0.0.4)
unf (0.0.5)
unf_ext (0.0.5 x86-mingw32)
user-choices (1.1.6.1)
watir-classic (3.4.0)
watir-webdriver (0.6.2)
webrobots (0.0.13)
websocket (1.0.6)
win32-api (1.4.8 x86-mingw32)
win32-process (0.7.1)
win32screenshot (1.0.7)
windows-api (0.4.2)
windows-pr (1.2.2)
xml-simple (1.1.2)
zip (2.0.2)
现在在下面,当我尝试nokogiri
时,得到如下错误,而它安装在我的桌面上
C:Ruby193>irb
irb(main):001:0> require 'nokogiri'
LoadError: cannot load such file -- nokogiri
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
from (irb):1
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):002:0> require 'selenium-webdriver'
=> true
irb(main):003:0>
您是否尝试安装mswin32-60
版本而不是x86-mingw32
版本?
gem install nokogiri --platform=x86-mswin32-60
编辑
或者,尝试更新您的rubygems版本gem update --system
确保在require 'nokogiri'
之前调用require 'rubygems'