PinkElephantsOnParade
PinkElephantsOnParade

Reputation: 6592

Upgrading my app to Rails 5. Not sure what to make of errors on bundle install

I changed the rails line in my app's Gemfile from:

gem 'rails', '4.2.3'

To:

gem 'rails', '5.0.0'

Per the rails documentation on the upgrade process. I then ran bundle update rails. I then hit a roadblock:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
dotenv-rails (= 2.0.2) was resolved to 2.0.2, which depends on
  railties (~> 4.0)

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

As I understand, railties is part of rails? So that seemed weird. To humor the error, I added:

gem 'railties', '5.0.0'

Then bundle update railties yields:

Bundler could not find compatible versions for gem "activerecord":
  In snapshot (Gemfile.lock):
    activerecord (= 4.2.3)

  In Gemfile:
    annotate was resolved to 2.7.2, which depends on
      activerecord (< 6.0, >= 3.2)

rails (= 5.0.0) was resolved to 5.0.0, which depends on
  activerecord (= 5.0.0)

I follow the rabbithole and add:

gem 'activerecord', '5.0.0'

bundle update activerecord yields...

You have requested:
  railties = 5.0.0

The bundle currently has railties locked at 4.2.3.
Try running `bundle update railties`

The whole reason I am even updating active record is so that I can update railties... it's running me in circles.

If I run bundle update with my full Gemfile now (activerecord and railties added):

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    devise (~> 3.5.6) was resolved to 3.5.6, which depends on
      railties (< 5, >= 3.2.6)

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

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

I'll admit I'm not a total pro at this process. Is there anything I am missing? Has anyone experienced something like this during their upgrade process?

Upvotes: 0

Views: 399

Answers (1)

Leonel Gal&#225;n
Leonel Gal&#225;n

Reputation: 7167

First error means bundle update dotenv-rails, if you are restricting the version make sure it's to one that supports railties 5. Based on your updates, it seems you are in a older devise too. So try to update both at the same time:

bundle update dotenv-rails devise, make sure you read the update notes in dotenv-rails and devise and change anything that needs to be change in your code.

My advise: go to the closest version that supports rails 5 first, so for devise that's 4.0.3 and dotenv-rails 2.1.2. Set this restrictions in your Gemfile before you bundle update. Only after you update this gems successfully attempt to update rails. Add any other gem that comes up to this same process.

Upvotes: 1

Related Questions