宝石依赖冲突

时间:2013-02-20 03:10:40

标签: ruby-on-rails rubygems dependencies bundler omniauth

我遇到了与上一个问题类似的问题,这个问题是在一年前发布的。 How do I fix this gem dependency problem in Rails 3 (bundler)?

我是ROR的新手。尝试在应用程序上运行bundle install时,我会收到以下内容:

Could not find twitter-2.5.0 in any of the sources

我试图删除我的Gemfile.lock。并再次尝试bundle install。并收到了输出:

Bundler could not find compatible versions for gem "faraday":
  In Gemfile:
    twitter (>= 0) ruby depends on
      faraday (~> 0.8) ruby

    omniauth (~> 0.3.2) ruby depends on
      faraday (0.7.3)

gem list

的结果
*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.19, 3.0.10)
actionpack (3.0.19, 3.0.10)
activemodel (3.0.19, 3.0.10)
activerecord (3.0.19, 3.0.10)
activeresource (3.0.19, 3.0.10)
activesupport (3.0.19, 3.0.10)
addressable (2.3.3, 2.2.8)
arel (2.0.10)
bcrypt-ruby (3.0.1)
bitly (0.8.0)
bson (1.6.4)
bson_ext (1.6.2)
builder (2.1.2)
bundler (1.2.3)
capybara (1.1.2)
carrierwave (0.5.8)
carrierwave-mongoid (0.1.7)
chef (11.2.0)
childprocess (0.3.5)
crack (0.3.1)
devise (1.5.3)
diff-lcs (1.1.3)
erubis (2.6.6)
excon (0.16.1)
factory_girl (4.0.0)
factory_girl_rails (4.0.0)
faraday (0.8.5)
ffi (1.1.5)
fog (1.5.0)
formatador (0.2.3)
formtastic (1.2.4)
gibbon (0.3.5)
growl (1.0.3)
guard (1.3.2)
guard-rspec (1.2.1)
guard-spork (1.1.0)
haml (3.1.7)
haml-rails (0.3.4)
hashie (1.2.0)
highline (1.6.15)
httparty (0.8.3)
httpauth (0.2.0)
i18n (0.5.0)
ipaddress (0.8.0)
jquery-rails (1.0.19)
json (1.7.6)
jwt (0.1.5)
koala (1.6.0, 1.4.0)
libwebsocket (0.1.5)
linkedin (0.3.7)
listen (0.4.7)
log4r (1.1.10)
macaddr (1.6.1)
mail (2.2.19)
mime-types (1.21, 1.19)
mini_magick (3.4)
mixlib-authentication (1.3.0)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.4.1)
mixlib-shellout (1.1.0)
mongo (1.6.2)
mongoid (2.2.6)
mongoid_slug (0.10.0)
mongoid_taggable (0.1.7)
multi_json (1.6.1, 1.0.4)
multi_xml (0.5.3, 0.4.4)
multipart-post (1.1.5)
net-ldap (0.2.2)
net-scp (1.0.4)
net-ssh (2.6.5, 2.5.2)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.1)
nokogiri (1.5.6, 1.5.5)
oa-basic (0.3.2)
oa-core (0.3.2)
oa-enterprise (0.3.2)
oa-more (0.3.2)
oa-oauth (0.3.2)
oa-openid (0.3.2)
oauth (0.4.7, 0.4.6)
ohai (6.16.0)
omniauth (1.1.3, 0.3.2)
omniauth-facebook (1.4.1)
omniauth-oauth2 (1.1.1)
orm_adapter (0.0.7)
polyglot (0.3.3)
pyu-ruby-sasl (0.0.3.3)
rack (1.2.8, 1.2.6, 1.2.3)
rack-mount (0.6.14)
rack-openid (1.3.1)
rack-test (0.5.7)
rails (3.0.19, 3.0.10)
rails_config (0.3.1)
railties (3.0.19, 3.0.10)
rake (10.0.3, 0.9.2)
rb-fchange (0.0.5)
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
rdiscount (1.6.8)
rdoc (3.12.1, 3.12)
remarkable (4.0.0.alpha4)
remarkable_activemodel (4.0.0.alpha4)
remarkable_mongoid (0.6.0)
rest-client (1.6.7)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
ruby-hmac (0.4.0)
ruby-openid (2.2.0)
ruby-openid-apps-discovery (1.2.0)
rubygems-bundler (1.1.0)
rubyntlm (0.1.1)
rubyzip (0.9.9)
rvm (1.11.3.6)
sass (3.2.1)
selenium-webdriver (2.25.0)
simple-navigation (3.8.0)
simple_oauth (0.2.0)
soloist (0.9.7)
spork (0.9.2)
sqlite3 (1.3.7)
sqlite3-ruby (1.3.3)
stringex (1.4.0)
subexec (0.2.2)
systemu (2.5.2)
thor (0.14.6)
treetop (1.4.12)
twitter (4.5.0)
tzinfo (0.3.35, 0.3.29)
uuid (2.3.5)
warden (1.2.1) 
will_paginate (2.3.16)
XMLCanonicalizer (1.0.1)
xpath (0.1.4)
yajl-ruby (1.1.0)

的Gemfile:

source 'http://rubygems.org'

gem 'rails', '~> 3.0.19'

#gem 'sqlite3-ruby', :require => 'sqlite3'
gem "haml-rails"
gem "sass"
gem "mongoid"
gem "mongo", "1.6.2"
gem "bson_ext", "1.6.2"
gem 'formtastic', '~> 1.2'
gem 'devise', '~> 1.4'
gem "declarative_authorization", :git => 'git://github.com/opusmagnum/declarative_authorization.git'
gem 'mongoid_taggable'
gem 'rdiscount'
gem "simple-navigation", "~> 3.6"
gem "will_paginate", "~> 2.3.16"
gem 'mongoid_slug', :require => 'mongoid/slug'
gem "omniauth", "~> 0.3.2"
gem "twitter" 
gem "koala"
gem "bitly"
gem "linkedin"
gem "rails_config"
gem 'gibbon', '~> 0.1'
gem 's3_swf_upload', :git => 'git://github.com/nathancolgate/s3-swf-upload-plugin'
gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
gem 'fog'
gem "mini_magick", "~> 3.3"
gem "jquery-rails"

group :test, :development do
  gem "factory_girl_rails"
  gem 'rspec-rails'
  gem 'capybara'
  gem 'remarkable_mongoid'
  gem 'spork'
  gem 'guard'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'rb-fsevent'
  gem 'growl'
end

我也尝试过将gem 'twitter', :git => 'https://github.com/sferik/twitter.git'添加到我的gemfile中的建议,但也没有运气。

任何帮助将不胜感激。感谢。

2 个答案:

答案 0 :(得分:3)

Gemfile中的一些gem被锁定到某些版本。这可能会在执行更新时产生问题,并且当您删除Gemfile.lock时,未锁定到版本的任何内容都将针对最新版本打开。通常我不认为吹掉锁文件是一种好习惯。

相反,您应该运行bundle update gemfile_name来更新特定的宝石。运行bundle update将尝试将所有gem更新为版本约束允许的最新版本。

如果您查看Gemfile.lock文件(与gem list不同),您将看到gems,它们的版本以及它们的依赖项。

基于此,您应该能够找出将法拉第加载为依赖项的内容,并尝试放宽版本约束。

答案 1 :(得分:2)

这个答案已经很晚了,但是你无意中升级了推特宝石,这篇评论在评论中作为gruzy notes被猛烈抨击。

只需指定另一个仓库,其标记不会为您破坏,也不会与法拉第冲突。对我来说,这是:

gem 'twitter', :git => 'https://github.com/sferik/twitter.git', :tag => 'v2.2.0'

您可能只是将v2.2.0替换为v2.5.0,并且破损应该消失。