ruby-on-railsrubydevisebundle-install

Bundler could not find compatible versions for gem "railties" when bundle update


I searched the SO, there are several related question, but can not solve my issue.

When I run: $ bundle update

Fetching gem metadata from https://gems.ruby-china.org/..........
Fetching version metadata from https://gems.ruby-china.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
devise (~> 3.5.0) was resolved to 3.5.1, which depends on
railties (< 5, >= 3.2.6)
rails (~> 5.0.1) was resolved to 5.0.1, which depends on
railties (= 5.0.1)

The picture is below:

enter image description here

And, I run $ rails -v:

Could not find gem 'devise (~> 3.5.0)' in any of the gem sources listed in your Gemfile or available on this machine.


Solution

  • You have fixed your version of devise to be a '3.5.x' version, which is incompatible with rails 5. In your Gemfile you will need to change the version of devise that you use, probably to a 4.x version, as 3.5, like this:

    gem 'devise', '~> 3.5.0'

    should become

    gem 'devise', '~> 4.1.0'

    or something like that.