Search code examples
ruby-on-railsruby-on-rails-5rails-upgrade

Upgrading to Rails 5, can't resolve dependencies


Upgrading from Rails 4.2.10 to Rails 5.1.4 results in the error message below. I am not sure how t resolve the dependencies. The ruby version is 2.5.1. Rails 4.2.10 runs without issue and bundle upgrade runs without returning any errors.

Update: added Gemfile below for reference. When deleting Gemfile.lock prior to performing bundle update, the below error message is still generated.

Error Message

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    rails (~> 5.1.4) was resolved to 5.1.4, which depends on
      activemodel (= 5.1.4)

web-console (~> 2.0.0.beta3) was resolved to 2.0.0, which depends on
  activemodel (~> 4.0)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    jbuilder (~> 2.7.0) was resolved to 2.7.0, which depends on
  activesupport (>= 4.2.0)

rails (~> 5.1.4) was resolved to 5.1.4, which depends on
  activesupport (= 5.1.4)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (~> 5.1.4)

Could not find gem 'rails (~> 5.1.4)' in any of the sources.Bundler could not 
find compatible versions for gem "activemodel":
  In Gemfile:
    rails (~> 5.1.4) was resolved to 5.1.4, which depends on
      activemodel (= 5.1.4)

web-console (~> 2.0.0.beta3) was resolved to 2.0.0, which depends on
  activemodel (~> 4.0)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
jbuilder (~> 2.7.0) was resolved to 2.7.0, which depends on
  activesupport (>= 4.2.0)

rails (~> 5.1.4) was resolved to 5.1.4, which depends on
  activesupport (= 5.1.4)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
rails (~> 5.1.4)

Could not find gem 'rails (~> 5.1.4)' in any of the sources.

Gemfile

source 'https://rubygems.org'

gem 'rails', '~> 5.1.4'
gem 'sass-rails'
gem 'bootstrap-sass'
gem 'bcrypt'
gem 'uglifier',     '~> 3.2.0'
gem 'coffee-rails', '~> 4.2.2'
gem 'jquery-rails', '~> 4.3.1'
gem 'turbolinks',   '~> 5.0.1'
gem 'jbuilder',     '~> 2.7.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'stripe'

group :development, :test do
  gem 'sqlite3',     '~> 1.3.9'
  gem 'byebug',      '~> 3.4.0'
  gem 'web-console', '~> 2.0.0.beta3'
  gem 'spring',      '~> 1.1.3'
end

group :test do
  gem 'minitest-reporters', '~> 1.0.5'
  gem 'mini_backtrace',     '~> 0.1.3'
  gem 'guard-minitest',     '~> 2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'puma'
end

Solution

  • The gem web-console is locking your update process, first change it to a more recent version like:

    gem 'web-console', '>= 3.3.0'
    

    Then remove Gemfile.lock and run bundle install also always is good to check the version of the other gems and check the official Rails upgrade process documentation in http://guides.rubyonrails.org/upgrading_ruby_on_rails.html