Search code examples
ruby-on-railsrubyrubygemsbundler

How do I update the version of Rails in my project? Bundler could not find compatible versions for gem "activemodel"


I don't understand the problem. Bundler says it needs activemodel >= 4.2.0, >= 4.0, and = 5.2.1.rc1. So why doesn't it just pick 5.2.1.rc1 because that satisfies all the dependencies?

There are dozens of errors like that for the gems rails, railties, etc.

I'm upgrading from Rails 4.2 to latest Rails. I commented out all version specifiers except Ruby and Rails. Here is my entire Gemfile.

workspace\>bundle
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rubygems.org/..
You have requested:
  rails ~> 5.2

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

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

C:\Users\Chloe\workspace\>bundle update rails
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    paperclip (~> 5.0) x64-mingw32 was resolved to 5.0.0, which depends on
      activemodel (>= 4.2.0) x64-mingw32

    rails (~> 5.2) x64-mingw32 was resolved to 5.2.1.rc1, which depends on
      activemodel (= 5.2.1.rc1) x64-mingw32

    web-console (~> 2.0) x64-mingw32 was resolved to 2.3.0, which depends on
      activemodel (>= 4.0) x64-mingw32

Solution

  • First back up your Gemfile.lock, then remove it and try doing bundle install again.