【问题标题】:couldn't load "nokogiri" in the IRB无法在 IRB 中加载“nokogiri”
【发布时间】:2013-02-27 10:42:08
【问题描述】:

我已在所需的 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>

【问题讨论】:

    标签: ruby nokogiri


    【解决方案1】:

    您是否尝试安装mswin32-60 版本而不是x86-mingw32 版本?

    gem install nokogiri --platform=x86-mswin32-60
    

    编辑

    或者,尝试更新您的 ruby​​gems 版本gem update --system

    【讨论】:

    • mswin32-60 是什么?
    • 我正在使用windows - xp 32位机。
    • 在irb中,RbConfig::CONFIG["build"]的输出是什么?
    • 我尝试如下:irb(main):003:0&gt; RbConfig::CONFIG["build"] =&gt; "i686-pc-mingw32"
    • 好的,所以您安装的 nokogiri 版本应该没问题,它至少使用了正确的平台。 gem --version 发布了什么?如果它低于 1.8.25,请尝试使用我的答案中的编辑进行升级。另外,gem contents nokogiri 是否显示 nokogiri 安装在与rake 相同的文件夹中?
    【解决方案2】:

    确保在require 'nokogiri'之前调用require 'rubygems'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-15
      相关资源
      最近更新 更多