0

I'm getting this error in upgrading various gems, as I'm trying to move from 4.2.11.1 to 5.0.1. Sample error for actionpack:

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    rails (= 5.0.1) was resolved to 5.0.1, which depends on
      actionpack (= 5.0.1)

    simple_form (= 5.0.0) was resolved to 5.0.0, which depends on
      actionpack (>= 5.0)

    twitter-bootstrap-rails (= 4.0.0) was resolved to 4.0.0, which depends on
      actionpack (~> 5.0, >= 5.0.1)

As far as my understanding is concerned about gem versions, this should not be an error, as version 5.0.1 satisfies all the dependencies. Can someone explain how can I get rid of such errors? I'm getting many such errors while upgrading

Gagan93
  • 1,826
  • 2
  • 25
  • 38

1 Answers1

-2

This is a tedious task and won't always be as easy.

I would suggest you follow this approach:

  1. Try deleting the Gemfile.lock also try to remove the gem versions from Gemfile if possible unless you specifically need the version. (you might want to keep version of rails, devise, aasm locked as there might be some major changes)
  2. Run bundle install
  3. At this step there are still chances you might get some conflicts in versions and dependencies
  4. You will have to open and check the specific gems for the dependencies
Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
  • This is not working for me. Whenever I do this and run bundler, it gets stuck completely on "Resolving dependencies" step. I waited for more than 5-6 hours before killing that task. @Deepak – Gagan93 Apr 19 '21 at 08:57
  • Well in that case you might have to upgrade failing gems one by one. In your case try `bundle update actionpack` You will have to do this for lot of gems and it will indeed take few hours depending on the size of the `Gemfile` – Deepak Mahakale Apr 19 '21 at 09:01
  • Easy approach. Comment gems from gemfile and try to run `bundle` with 10 gems then uncomment 10 more maybe – Deepak Mahakale Apr 19 '21 at 09:02
  • I understand your binary search kind of approach. Just wanted to learn - Is this even a valid error or is there some issue in my understanding of how bundler resolves things? – Gagan93 Apr 19 '21 at 10:38
  • Yes, this is a valid error when "few of your gem requires the older version but other gem requires a newer version and they don't overlap " To give you an example one requires `<= 5` but the other require `> 6` of the same gem as dependency – Deepak Mahakale Apr 20 '21 at 08:35
  • can you check carefully? The above error doesn't make a lot of sense to me. It should use 5.0.1 IMO. – Gagan93 Apr 22 '21 at 04:32