Sauron
Sauron

Reputation: 6657

Could not find compatible versions for gem "rack"

I am attempting to update my app to Rails 5.0.1. After attempting to run bundle update, the error below appears, but there is no rack gem.

How can I get this to resolve?

Error:

 Bundler could not find compatible versions for gem "rack":
      In Gemfile:
        rails (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
          actionpack (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
            rack (~> 2.0)

        rails (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
          actionpack (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
            rack (~> 2.0) x86-mingw32

        sprockets (= 2.11.3) was resolved to 2.11.3, which depends on
          rack (~> 1.0)

        sprockets (= 2.11.3) was resolved to 2.11.3, which depends on
          rack (~> 1.0) x86-mingw32

gemfile:

source 'http://rubygems.org'
ruby '2.4.0'  # '1.9.3'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '5.0.1'#'4.2.6'
#gem 'pg', '0.15.1'
gem 'mysql2', '0.4.5'#'0.4.4'
gem 'bootstrap-sass', '2.3.2.0'#'3.3.6'
gem 'bcrypt', '3.1.11'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'geocoder', '1.3.7'
gem 'nested_form', '0.3.2'
gem 'utf8-cleaner', '0.2.4'
gem 'sprockets', '2.11.3' #2.11.3
gem 'json', '1.8.6'#'1.8.3'
gem 'ffi'
gem 'iconv', '1.0.4'

gem 'chosen-rails', '1.5.2'
gem 'compass-rails', github: 'Compass/compass-rails'

# For image uploads
gem 'carrierwave', '0.11.2'

# For uploading CSV
gem 'roo', '2.4.0'

# DataTables
gem 'jquery-datatables-rails', '3.4.0' #  git: 'git://github.com/rweng/jquery-datatables-rails.git'
gem 'jquery-ui-rails', '5.0.5'

# Editing in line:
gem 'best_in_place', '3.1.0'

# Passing data from controller to coffeescript
gem 'gon', '6.0.1'
#gem 'jquery-turbolinks' '2.1.0'

# For searching and webservice queries-NO LONGER USED
#gem 'sunspot_rails', '2.1.0'
#gem 'sunspot_solr', '2.1.0'
gem 'progress_bar', '1.0.5'

gem 'responders', '2.2.0'

# Calendar Date and Validation
gem 'bootstrap-datepicker-rails'

# For Google Maps overlays
gem 'gmaps4rails', '~> 2.1.2'
gem 'underscore-rails', '~> 1.8.3'

group :development, :test do
  gem 'rspec-rails', '3.4.2'
  gem 'guard-rspec', '4.7.2'
  gem 'spork-rails', '4.0.0'
  gem 'childprocess', '0.5.9'
  gem 'guard-spork', '2.1.0'
end

group :test do
  gem 'selenium-webdriver', '2.53.3'
  gem 'capybara', '2.7.1'
  gem 'factory_girl_rails', '4.7.0'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.1.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '2.5.3'
gem 'jbuilder', '2.5.0'

group :doc do
  gem 'sdoc', '0.4.1', require: false
end

gem 'rails_12factor', '0.0.3'

Upvotes: 0

Views: 1581

Answers (1)

Holger Just
Holger Just

Reputation: 55758

It's all in the error message:

You ave specified gems in your Gemfile which have conflicting dependencies on the rack gem. Rails 5 (via actionpack) required rack 2 which your pinned version of sprockets requires rack 1.

Thus, you have two options:

  1. You could downgrade your rails requirement to Rails 4 which then depends on rack 1. For that, replace the line in your Gemfile where you specify rails with this:

    gem 'rails', '< 5'
    
  2. Alternatively (and this is probably your desired option), you could upgrade the version of sprockets you are using. For that, you can simply remove the explicit pinned version to sprockets in your Gemfile. Since Rails already depends on a suitable version of sprockets, you don't need to specify it as a version youself. Generally, in order to use sprockets with Rails 5, you need at least sprockets 3.3.5.

Upvotes: 3

Related Questions