捆绑更新时,Bundler 找不到 gem "railties" 的兼容版本

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

我搜索了SO,有几个相关问题,但都不能解决我的问题。

当我运行:$ 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)

图片如下:

而且,我 运行 $ 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.

您已将您的设计版本修复为 '3.5.x' 版本,该版本与 rails 不兼容 5. 在您的 Gemfile 中,您需要更改设计的版本您使用的可能是 4.x 版本,如 3.5,如下所示:

gem 'devise', '~> 3.5.0'

应该变成

gem 'devise', '~> 4.1.0'

或类似的东西。