45

I am trying to upgrade to Rails 4.0.0, and I changed the gem versions of sass-rails and coffee-rails. I need to resolve this gem conflict between rails and coffee-rails before I can upgrade to Rails 4.

When I ran bundle update this is the output I got:

$ bundle update
Updating git://github.com/pilu/web-app-theme.git
Fetching source index from https://rubygems.org/
Resolving dependencies..............
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      railties (= 4.0.0) ruby

    coffee-rails (= 4.0.0) ruby depends on
      railties (4.0.0.rc2)

My Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.0.0'

gem 'cancan'
gem 'client_side_validations'
gem 'devise', '~> 1.5.3'
gem 'dynamic_form'
gem 'execjs'
gem 'haml'
gem 'httparty'
gem 'jquery-rails'
gem 'mysql2'
gem 'paperclip', '~> 2.4'
gem 'prawn'
gem 'rails3-jquery-autocomplete'
gem 'rake', '0.9.2'
gem 'remotipart', '~> 1.0'
gem 'simple_datatables'
gem 'therubyracer'
gem 'validates_timeliness', '~> 3.0.2'
gem 'will_paginate', '~> 3.0'

gem 'turbolinks'
gem 'jquery-turbolinks'

gem 'noty-rails'

gem 'font-awesome-rails'

gem 'socket.io-rails'

gem 'attr_encrypted'

gem 'bullet', :group => 'development'

#temp for demo.managetherapy.com
#gem 'faker'

group :test do
  gem 'capybara'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
  gem 'factory_girl_rails'
#  gem 'faker'
  gem 'guard-rspec'
  gem 'selenium-webdriver', '2.7.0'
  gem 'webrat'
end

group :development, :test do
  gem 'faker'
  gem 'haml-rails'
  gem 'hpricot'
  gem 'rspec-rails'
  gem 'ruby_parser'
  #gem 'web-app-theme', '~> 0.8.0'
  gem 'web-app-theme', :git =>'git://github.com/pilu/web-app-theme.git'
end

gem 'sass-rails', '4.0.0'
gem 'compass-rails', '1.0.3'
gem 'coffee-rails', '4.0.0'
gem 'uglifier', '>= 2.1.1'
gem 'bootstrap-sass-rails'

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

# Deploy with Capistrano
gem 'capistrano'
gem 'rvm-capistrano'

gem 'passenger'
Palec
  • 12,743
  • 8
  • 69
  • 138
Brian Petersen
  • 491
  • 1
  • 4
  • 5

6 Answers6

72

Also bundle update only allows you to update one gem at a time, which is hard if you are updating to Rails 4 and a whole lot of gems have to be updated at the same time.

I solved this by deleting the Gemfile.lock and doing bundle install.

This is of course assuming you have no conflicting explicit gem version in your Gemfile to start with. So if this fails, remove version numbers from the Gemfile.

nathanvda
  • 49,707
  • 13
  • 117
  • 139
  • 2
    This works for me. Delete `Gemfile.lock` and everything is as smooth as hell :D. – Tu H. Aug 22 '13 at 07:52
  • 7
    This worked for me: I must add, that also, if one gem in specific is causing issues, change the ~> for >= (ex. gem 'coffee-rails', '~> 4.0.0' for gem 'coffee-rails', '>= 4.0.0') and follow nathanvda steps – Jorge Sampayo Sep 07 '13 at 13:52
  • 6
    The `~>` will update, but only patchlevel (so according to semver: only non-breaking changes). Changing to `>=` will update to the latest version (taking all other dependencies/constraints into account), and actually just states a minimal version that is needed (from your end). So yes: that is probably most definitely needed. – nathanvda Sep 07 '13 at 14:37
  • Awesome, this worked for me as well. Thanks for the tip! – Keenan Payne Dec 13 '13 at 19:06
  • 1
    Did NOT work for me, I found ExReanimator's answer worked for me – Michael Durrant Aug 17 '14 at 19:26
  • Well this answer is not a psychic, I have you have explicit versions in your `Gemfile`, and they conflict, you will have to remove the explicit gem version. I will extend my answer accordingly. Main thing, for me, was to delete the `Gemfile.lock`, otherwise I was never able to update. So if you started with ExReanimators answer, it would not have worked unless you deleted the Gemfile.lock. But happy you got it to work. – nathanvda Aug 18 '14 at 08:24
28

Just remove gem versions (coffee-rails and sass-rails) from Gemfile and run bundle update

Ivan Schneider
  • 1,145
  • 1
  • 11
  • 20
12

Run gem update rails first, then bundle update

andreofthecape
  • 1,166
  • 11
  • 24
9

You have an outdated version of Devise, use Rails 4 compatible

gem 'devise', '~> 3.0.0.rc'

Also change coffee-rails to

gem 'coffee-rails', '~> 4.0.0'

and try doing

bundle update coffee-rails
Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63
7

You have gems that aren't supported by Rails 4. Comment out all the gems except for Rails 4 and uncomment them one at a time after running bundle install to find the culprits. You might need to undo some of your version locks.

penner
  • 2,707
  • 1
  • 37
  • 48
2
  1. Delete the Gemfile.lock file
  2. refer here for basic gemfile changes
  3. run bundle install

Everything will work fine. :)

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85