3

我的本地宝石是:

actionmailer (3.2.4.rc1, 3.2.3)
actionpack (3.2.4.rc1, 3.2.3)
activemodel (3.2.4.rc1, 3.2.3)
activerecord (3.2.4.rc1, 3.2.3)
activeresource (3.2.3)
activesupport (3.2.4.rc1, 3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.3)
coffee-script-source (1.3.3)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
json (1.7.3)
mail (2.4.4)
mime-types (1.18)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.4.rc1, 3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
sprockets (2.1.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)

我的 Gemfile 看起来像:

source 'https://rubygems.org'

gem 'rails', '3.2.3'

group :development, :test do
  gem 'sqlite3' ,'1.3.6'
  gem 'rspec-rails', '2.10.0'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails' ,'2.0.0'

group :test do
   gem 'capybara' , '1.1.2'
end

group :production do
  gem 'pg' , '0.12.2'
end

但是在执行时bundle install --without production,我得到

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 3.2.3) ruby depends on
      railties (= 3.2.3) ruby

    jquery-rails (= 2.0.0) ruby depends on
      railties (3.2.4.rc1)

即使我可以在本地 gem 中看到 railties 3.2.3 和 3.2.4.rc1,为什么 bundle 无法安装 jquery-rail 2.0.0。当我已经安装了 Rails 3.2.3 时,它为什么要我安装这个版本?

4

2 回答 2

1

我遇到了类似的问题,我能够通过注释掉导致依赖问题的 gem(s) 来解决它,运行bundle,取消注释 gem(s),然后bundle再次运行。

在你的情况下,我会尝试评论和取消评论jquery-rails

于 2013-01-09T19:59:07.910 回答
1

是的,但是 bundler 不会让你使用两个不同版本的 gem。你有一个版本依赖冲突,因为rails 3.2.3依赖railties 3.2.3jquery-rails 2.0.0依赖railties 3.2.4.rc1.

您应该使用旧jquery-rails版本或新rails版本。

于 2012-05-31T10:05:03.803 回答