Rails 3.1.2 - Bundler could not find compatible versions for gem "railties"

14,053

Solution 1

Solution:

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

And then

bundle update

Solution 2

The answer is in Bundler's output. Your project is using Rails 3.1.2, which requires railties 3.1.2. The version of twitter-bootstrap-rails you are trying to install apparently depends on railties >= 3.2.1, which you don't have.

You have three options, from the looks of it:

  1. Take a look at the twitter-bootstrap-rails repo and take note of the fact that it looks like they are trying to lower the dependencies back to >= 3.1. Wait for a new version to be released or use their master branch.
  2. Upgrade your project to use Rails 3.2
  3. Use an older version of twitter-bootstrap-rails that still works with Rails 3.1.
Share:
14,053
user984621
Author by

user984621

Updated on June 15, 2022

Comments

  • user984621
    user984621 almost 2 years

    I am trying to install the new version of the twitter-bootstrap-rails gem (v2), but getting the error above. This is how my Gemfile looks:

    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'
    

    And complete error:

    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)
    

    What is wrong? When I remove the version ~> 2.0 from the gem, it works, but I need the new version of bootstrap...

    EDIT: bundle install

    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.
    
  • John Lockwood
    John Lockwood almost 12 years
    I had a similar problem and the bundle update was the solver. Voted up. Cheers.
  • busyPixels
    busyPixels over 11 years
    I tried this and it worked locally but as soon as I push to heroku I get the "We're sorry, but something went wrong." view. Any insight into how to resolve this? github.com/aharris/The-Childrens-Journey/commit/…
  • shajin
    shajin about 11 years
    Can u explain what happened and what u did to overcome this pblm??