I am migrating an application from Rails 4 to Rails 5 but am struggling to get a complete bundle due to dependency conflicts. I am a bit confused as to why this is a problem as I don't completely understand why the bundler cannot resolve the dependencies.
In this case, I am on Windows. I have installed Ruby 2.5.5 using BitNami Ruby and installed Rails 5.2.3. I deleted Gemfile.lock and ran bundle install. The Gemfile specifies Ruby 2.5.5 and Rails 5.2.3. No other gems have version requirements specified. Bundle is at 1.17.3.
My interest on this issue, other converting this particular application, is to better understand how bundle resolves dependencies. Looking at the bundler documentation, I haven't discovered the reason for some conflicts. As an example, why would the bundler not accept actionpack 5.2.3 in this case:
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
jquery-datatables-rails x64-mingw32 was resolved to 3.4.0, which depends on
actionpack (>= 3.1) x64-mingw32
rails (= 5.2.3) x64-mingw32 was resolved to 5.2.3, which depends on
actionpack (= 5.2.3) x64-mingw32
rspec-rails x64-mingw32 was resolved to 3.8.2, which depends on
actionpack (>= 3.0) x64-mingw32
simple_form x64-mingw32 was resolved to 4.1.0, which depends on
actionpack (>= 5.0) x64-mingw32
rails (= 5.2.3) x64-mingw32 was resolved to 5.2.3, which depends on
sprockets-rails (>= 2.0.0) x64-mingw32 was resolved to 3.2.1, which
depends on
actionpack (>= 4.0) x64-mingw32
Getting an understanding of this particular case would really help me. I'd appreciate your assistance.
Gemfile is as follows:
source 'https://rubygems.org'
ruby '2.5.5'
gem 'rails', '5.2.3'
gem 'aasm'
gem 'active_model-errors_details'
gem 'acts_as_tenant'
gem 'acts_as_xlsx'
gem 'addressable'
gem 'autoprefixer-rails'
gem 'awesome_print'
gem 'aws-sdk'
gem 'aws-sdk-core'
gem 'aws-sdk-resources'
gem 'axlsx'
gem 'axlsx_rails'
gem 'better_delayed_job_web'
gem 'bindex'
gem 'bootstrap-sass'
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'exception_notification'
gem 'exception_notification-rake'
gem 'figaro'
gem 'ffi'
gem 'font-awesome-sass'
gem 'forgery'
gem 'htmlentities'
gem 'jquery-datatables-rails'
gem 'jquery-rails'
gem 'jquery-turbolinks'
gem 'jquery-ui-rails'
gem 'json_pure'
gem 'logging'
gem 'nokogiri'
gem 'paloma'
gem 'pg'
gem 'phony'
gem 'phony_rails'
gem 'rake'
gem 'redis'
gem 'responders'
gem 'robocop'
gem 'rolify'
gem 'roo'
gem 'roo-xls'
gem 'rubyzip'
gem 'sass'
gem 'sass-rails'
gem 'simple_form'
gem 'smarter_csv'
gem 'sorcery'
gem 'spreadsheet'
gem 'sprockets'
gem 'sprockets-rails'
gem 'turbolinks'
gem 'twilio-ruby'
gem 'tzinfo-data'
gem 'uglifier'
gem 'will_paginate'
group :production, :staging do
gem 'rails_12factor'
platforms :ruby do
gem 'unicorn'
end
end
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'brakeman'
gem 'bullet'
gem 'coffee-rails-source-maps'
gem 'meta_request'
gem 'require_reloader'
gem 'quiet_assets'
gem 'rails_layout'
gem 'rubocop'
gem 'web-console'
end
group :development, :test do
gem "faker"
gem "squasher"
gem 'fabrication'
gem 'factory_bot_rails'
gem 'letter_opener'
gem 'method_source'
gem 'rspec'
gem 'rspec-collection_matchers'
gem 'rspec-core'
gem 'rspec-expectations'
gem 'rspec-mocks'
gem 'rspec-rails'
gem 'rspec-support'
gem 'thin'
end
group :test do
gem "launchy"
gem 'capybara'
gem 'chromedriver-helper'
gem 'database_cleaner'
gem 'email_spec'
gem 'json_spec'
gem 'mocha'
gem 'selenium-webdriver'
gem 'shoulda-callback-matchers'
gem 'shoulda-matchers'
end
When you look at the complete output from your bundle install
it is pretty long:
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
jquery-datatables-rails was resolved to 3.4.0, which depends on
actionpack (>= 3.1)
rails (= 5.2.3) was resolved to 5.2.3, which depends on
actionpack (= 5.2.3)
rspec-rails was resolved to 3.8.2, which depends on
actionpack (>= 3.0)
simple_form was resolved to 4.1.0, which depends on
actionpack (>= 5.0)
rails (= 5.2.3) was resolved to 5.2.3, which depends on
sprockets-rails (>= 2.0.0) was resolved to 3.2.1, which depends on
actionpack (>= 4.0)
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
rails (= 5.2.3) was resolved to 5.2.3, which depends on
activemodel (= 5.2.3)
web-console was resolved to 4.0.1, which depends on
activemodel (>= 6.0.0)
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
acts_as_xlsx was resolved to 1.0.6, which depends on
activerecord (>= 2.3.9)
better_delayed_job_web was resolved to 1.3.12, which depends on
activerecord (> 3.0.0)
delayed_job_active_record was resolved to 4.1.4, which depends on
activerecord (>= 3.0, < 6.1)
rails (= 5.2.3) was resolved to 5.2.3, which depends on
activerecord (= 5.2.3)
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
active_model-errors_details was resolved to 1.1.1, which depends on
activesupport
delayed_job was resolved to 4.1.8, which depends on
activesupport (>= 3.0, < 6.1)
exception_notification-rake was resolved to 0.3.0, which depends on
exception_notification (~> 4.2.0) was resolved to 4.2.2, which depends on
activesupport (>= 4.0, < 6)
rails (= 5.2.3) was resolved to 5.2.3, which depends on
activesupport (= 5.2.3)
rspec-rails was resolved to 3.8.2, which depends on
activesupport (>= 3.0)
shoulda-matchers was resolved to 4.1.2, which depends on
activesupport (>= 4.2.0)
rails (= 5.2.3) was resolved to 5.2.3, which depends on
sprockets-rails (>= 2.0.0) was resolved to 3.2.1, which depends on
activesupport (>= 4.0)
Bundler could not find compatible versions for gem "axlsx":
In Gemfile:
axlsx
acts_as_xlsx was resolved to 1.0.6, which depends on
axlsx (>= 1.0.13)
axlsx_rails was resolved to 0.5.2, which depends on
axlsx (>= 2.0.1)
Bundler could not find compatible versions for gem "exception_notification":
In Gemfile:
exception_notification
exception_notification-rake was resolved to 0.3.0, which depends on
exception_notification (~> 4.2.0)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 5.2.3)
acts_as_tenant was resolved to 0.4.4, which depends on
rails (>= 4.0)
axlsx_rails was resolved to 0.1.5, which depends on
rails (>= 3.1)
Maybe too long, and there is a lot of noise in the output. But if you try to dig through you will find some interesting lines:
web-console was resolved to 4.0.1, which depends on
activemodel (>= 6.0.0)
this means that web-console
v4.0.1 needs at least activemodel
gem 6.0.0, so you should limit web-console
to valid version for rails 5, which is 3.7.0, version in your gemfile:
gem web-console, '< 4.0'
now when you try to run bundle install
again it will show you similar errors again but there will be some differences. In new output you will find following difference:
active_model-errors_details was resolved to 1.1.1, which depends on
activemodel (>= 4.0, < 5.0.0.alpha)
This means that active_model-errro_details
cannot be run with Rails 5. According to Rubygems, this gem cannot be run with Rails 5.2.3 see https://rubygems.org/gems/active_model-errors_details, so I commented it out in gemfile:
# gem 'active_model-errors_details'
and tried to run bundle install
again. There are still some compatibility errors with gem versions this time it is quiet_assets
gem:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
quiet_assets was resolved to 1.0.1, which depends on
railties (~> 3.1)
You can see it dependes on Rails 3.x. If you look at the rubygems, you will see that even the latest version of quiet_assets
cannot be run with Rails 5. Again I removed the gem from the Gemfile:
# gem 'quiet_assets'
Now when you try to run bundle install
all of the gems version problems will be solved and gems will be successfully installed.
It is a bit messy and there is a lot of noise in the error output, but if you read it carefully, you will find what is wrong.