【问题标题】:Ruby require errorsRuby 需要错误
【发布时间】:2012-06-17 11:02:39
【问题描述】:

要求安装的 gem 不可见。

用我安装了几次的 hpricot 进行测试:

irb(main):001:0> require "rubygems"
=> false
irb(main):002:0> require "hpricot"
LoadError: no such file to load -- hpricot
        from (irb):2:in `require'
        from (irb):2
        from /usr/bin/irb:12:in `<main>'
irb(main):003:0> 

RubyGems 环境:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-07-02 patchlevel -1) [i486-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.2
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.2
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.9.2/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.2
     - /root/.gem/ruby/1.9.2
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

我安装了多个版本的 ruby​​(回溯 5r2)

targeex@bt:/home/targeex/Stage/Application_Wissam# update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/ruby1.8     600       auto mode
  1            /usr/bin/ruby1.8     600       manual mode
* 2            /usr/bin/ruby1.9.2   400       manual mode

Press enter to keep the current choice[*], or type selection number: 2

我能做什么?

【问题讨论】:

  • 仅供参考,如果您在 Ruby 1.9 中使用 IRB,则不需要 Rubygems。它是自动加载的。

标签: ruby ubuntu gem require


【解决方案1】:

看起来您可能没有在正确的 ruby​​ 中安装 gem。如果可以的话,切换到使用 RVM (https://rvm.io/) 它会治愈你的困扰。

【讨论】:

    猜你喜欢
    • 2012-06-12
    • 2015-09-12
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-05
    相关资源
    最近更新 更多