错误:找不到有效的宝石' libxml-ruby' (> = 0)

时间:2014-07-05 04:52:57

标签: ruby-on-rails

我有一个我复制到我的机器的rails应用程序。我在访问应用程序时遇到以下错误。

    MissingSourceFile (no such file to load -- xml):
    app/controllers/results_controller.rb:6
    /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
   /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:95:in `start'
   /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:92:in `each'
   /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:92:in `start'
   /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:23:in `start'
   /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:82:in `start'

我尝试安装libxml,收到以下错误:

  [root@localhost log]# gem install libxml-ruby
  WARNING:  RubyGems 1.2+ index not found for:
  RubyGems will revert to legacy indexes degrading performance.
  ERROR:  Could not find a valid gem 'libxml-ruby' (>= 0) in any repository
  [root@localhost log]#

如何解决此问题?

Rails版本:2.3.8 Ruby版本:1.8.7 操作系统:FC18

1 个答案:

答案 0 :(得分:0)

该错误意味着您的用户无法解析libxml-ruby的宝石来源。 libxml-ruby似乎也由rubygems.org托管。因此,您可以将https://rubygems.org添加到您的源并安装gem。

# gem sources -a https://rubygems.org
https://rubygems.org added to sources

然后安装libxml-ruby

# gem install libxml-ruby

这应该成功安装gem。

要查看可用来源列表,您可以发出gem sources

# gem sources