Rails 3.1.2 - Bundler找不到gem“railties”的兼容版本

时间:2012-02-01 15:50:24

标签: ruby-on-rails-3.1 bundler gemfile

我正在尝试安装新版本的twitter-bootstrap-rails gem(v2),但收到上述错误。这就是我的Gemfile的外观:

source 'http://rubygems.org'

gem 'rails', '3.1.2'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'


gem 'mysql2'
gem 'authlogic'
gem "paperclip", "~> 2.4.5"
gem 'aws-s3'
gem 'actionmailer'
gem "twitter-bootstrap-rails", "~> 2.0"
gem 'sunspot_rails'

#endless page
gem 'will_paginate'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5.rc.2'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

group :production do
  gem 'therubyracer-heroku', '~> 0.8.1.pre3'
  gem 'pg'
  gem 'thin'
end

group :development do
  gem "taps", "~> 0.3.23"
  gem "rvm", "~> 1.9.2"
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

完成错误:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

    sass-rails (~> 3.1.5.rc.2) ruby depends on
      railties (3.1.0)

有什么问题?当我从gem中删除版本~> 2.0时,它可以工作,但我需要新版本的bootstrap ......

编辑:捆绑安装

Bundler could not find compatible versions for gem "railties":
  In snapshot (Gemfile.lock):
    railties (3.1.2)

  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

2 个答案:

答案 0 :(得分:22)

解决方案:

gem 'rails', '3.2.1'
gem "sass-rails", "~> 3.2.4"
gem "coffee-rails", "~> 3.2.2"

然后

bundle update

答案 1 :(得分:1)

答案在Bundler的输出中。您的项目使用的是Rails 3.1.2,它需要使用栏目3.1.2。您尝试安装的twitter-bootstrap-rails版本显然取决于您没有的栏杆> = 3.2.1。

从外观上看,您有三种选择:

  1. 看一下twitter-bootstrap-rails repo,并注意看起来他们试图将依赖关系降低到> = 3.1。等待新版本发布或使用他们的主分支。
  2. 升级您的项目以使用Rails 3.2
  3. 使用旧版本的twitter-bootstrap-rails,它仍适用于Rails 3.1。