2010-11-18 58 views
0

我收到以下错误:无法激活宝石:我怎么知道哪个宝石对这个宝石有依赖性?

Gem::Exception: can't activate hpricot (= 0.6.161, runtime), 
already activated hpricot-0.8.3 

0.6安装在本地,0.8.3在我的应用程序被冻结。

这是我的“堆栈跟踪”:

Loading production environment (Rails 2.3.10) 
/software/ruby-ror-gem-1.3.1/lib/rubygems.rb:149:in `activate':Gem::Exception: can't activate hpricot (= 0.6.161, runtime), already activated hpricot-0.8.3 
/e/app/www.example.com/rails/releases/20101117142713/vendor/rails/railties/lib/console_with_helpers.rb:5:NameError: uninitialized constant ApplicationController 

我如何找出哪些宝石或图书馆对角度来说,Hpricot 0.6的依赖?


我已经添加下面user438962的命令的输出:

{"daemons-1.0.9"=>[], 
"scgi_dp_rails-0.0.5"=>["preforkdp", "daemons"], 
"rails-2.3.10"=>[], 
"rwfd-0.1.0"=>[], 
"nokogiri-1.3.2"=>["racc", "rexical", "rake-compiler", "hoe"], 
"activesupport-2.3.10"=>[], 
"rack-1.0.1"=> 
    ["test-spec", 
    "camping", 
    "fcgi", 
    "memcache-client", 
    "mongrel", 
    "ruby-openid", 
    "thin"], 
"rack-1.1.0"=> 
    ["test-spec", "camping", "fcgi", "memcache-client", "mongrel", "thin"], 
"preforkdp-0.1.2"=>["rwfd"], 
"activerecord-2.3.10"=>[], 
"hpricot-0.6.161"=>[], 
"cgi_multipart_eof_fix-2.5.0"=>[], 
"fastthread-1.0.1"=>[], 
"gem_plugin-0.2.3"=>[], 
"activeresource-2.3.10"=>[], 
"ferret-0.11.6"=>["rake"], 
"mysql-2.7"=>[], 
"actionmailer-2.3.10"=>[], 
"actionpack-2.3.10"=>[], 
"hpricot-0.8.3"=>[], 
"mongrel_upload_progress-0.2.2"=>["mongrel", "gem_plugin"], 
"mongrel-1.1.3"=> 
    ["gem_plugin", "daemons", "fastthread", "cgi_multipart_eof_fix"], 
"mongrel_cluster-1.0.5"=>["gem_plugin", "mongrel"], 
"rake-0.8.4"=>[], 
"haml-2.0.9"=>[], 
"remvee-mini_magick-1.2.3.4.0"=>[]} 
+1

是否有堆栈跟踪?另外,我强烈建议使用rvm来防止这些事情发生:http://rvm.beginrescueend.com/ – Thilo 2010-11-18 08:57:53

+0

有一个很短的堆栈跟踪,增加了问题。我喜欢rvm,但无法安装在这台服务器上。 – 2010-11-18 13:05:07

+1

此问题非常具体,可能会被关闭。 – 2011-05-18 21:54:56

回答

2

如果使用捆扎机,你避免这个问题,你有真正伟大的命令:bundle viz

此命令生成一个包含所有依赖关系的图。

+1

是的,但我不知道,这是一个传统的应用程序。 – 2010-11-18 11:23:20

1
require 'rubygems' 
require 'pp' 
h = {} 
Gem.source_index.each{|g, spec| h[g] = spec.dependencies.map{|d| d.name} } 
pp h 
0

问题将是您使用的宝石之一取决于角度来说,Hpricot版本0.6.161 等尝试加载它,但你已经角度来说,Hpricot-0.8.3加载。如果您自己使用hpricot,则可能会加载较新的版本,并且未指定版本就需要使用hpricot。如果是这种情况,您可以将自己的需求更改为其他宝石使用的相同版本(0.6.161)。

更新版本的hpricot被加载的另一个原因可能是您使用的另一个gem取决于该版本的hpricot,这意味着您不能使用这两个gem的特定版本,因为它们有冲突他们的hpricot版本的要求。

使用其他用户发布的方法来帮助您追踪您正在使用的宝石的依赖关系。

+0

我正在使用hpricot的0.8.3版本 - 只是我无法找到与0.6.161版本相关的gem。我已经添加了依赖输出到问题。 – 2010-11-18 23:04:07

+0

显然所有本地安装的宝石都被加载,因为我只使用3,但我不知道为什么。 – 2010-11-19 09:30:25

+0

也许一个插件或宝石出售到你的Rails应用程序,它有售价的hpricot 0.6.161?检查'vendor/plugins/**/vendor /'和'vendor/gems/**/vendor /'来查看是否有hpricot。他们可能会在该版本中冻结宝石,但未指定它。 – Jeremy 2010-11-20 05:24:21

0

你可以尝试grepping您的负载路径:

$:.each do |dir| 
    cmd = %(grep -r hpricot #{dir}) 
    puts cmd 
    puts `#{cmd}` 
end 
1

我发现rfeedparser是使用角度来说,Hpricot 0.6宝石。

问题是此版本(0.6)与rfeedparser一起使用,但发出警告“不向XML :: SaxParser.new传递参数”。

那么,随着更新版本的hpricot(至少0.8.2),这个警告似乎已经生效,因为现在拥有该版本的hpricot或更新版本会导致“ArgumentError:错误的参数数目(1代表0)”当调用FeedParser.parse(url)。

不幸的是,我发现使用旧版Rails(我们有一个2.2.2应用程序)的唯一方法是卸载任何不是0.6的hpricot版本。