Search code examples
ruby-on-railsrubygemfileactionpackbundle-install

Ruby - Unable to resolve dependencies with actionpack


I did a bundle install and bundle update and found that I keep getting the same error in the terminal:

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

    rails (~> 5.0.0) was resolved to 5.0.0, which depends on
      railties (= 5.0.0) was resolved to 5.0.0, which depends on
        actionpack (= 5.0.0)

    rails (~> 5.0.0) was resolved to 5.0.0, which depends on
      railties (= 5.0.0) was resolved to 5.0.0, which depends on
        actionpack (= 5.0.0)

    rails (~> 5.0.0) was resolved to 5.0.0, which depends on
      railties (= 5.0.0) was resolved to 5.0.0, which depends on
        actionpack (= 5.0.0)

    simple_form (~> 3.0.2) was resolved to 3.0.2, which depends on
      actionpack (~> 4.0)

I updated a lot of the gems and got solved all the dependency errors but this one I can't seem to solve.

This is my gemfile:

source 'https://rubygems.org'
gem 'rails', '~> 5.0.0'
gem 'sqlite3'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0.5'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'

gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'simple_form', '~> 3.0.2'
gem 'devise', '~> 4.2'
gem 'haml', '~> 4.0.5'


group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Is there something I'm missing from my gemfile to resolve this issue? Apologies if this isn't explained very well, Im a newbie (and spent a few hours trying to solve this on my own!)


Solution

  • There are a lot information about dependencies in Gemfile and from Error.

    railties (= 5.0.0) was resolved to 5.0.0, which depends on actionpack (= 5.0.0)

    simple_form (~> 3.0.2) was resolved to 3.0.2, which depends on actionpack (~> 4.0)

    ~> This limits versions to a subset of the possible versions. Read about it.

    So from error you can read, that simple_form depends from actionpack, which can be only from 4.0 to 4.1 version. But railties depends on actionpack at least version 5.0.

    To resolve this problem you must update simple_form gem. For example version 3.2.1 has next specification of actionpack:

    s.add_dependency('actionpack', '> 4', '< 5.1')