Ruby 在 Rails 上:捆绑包更新:捆绑器无法解析似乎可以解析的依赖项

Ruby On Rails: bundle update: bundler can't resolve dependencies that seem to be resolvable

作为 Rails 升级的一部分,我 运行 bundle update rails。我对输出有点困惑。

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    mongoid was resolved to 6.1.1, which depends on
      activemodel (~> 5.0)

    rails (= 5.0.7.2) was resolved to 5.0.7.2, which depends on
      activemodel (= 5.0.7.2)

5.0.7.2不满足(~> 5.0)吗?

同样:

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (= 5.0.7.2)

    minitest-spec-rails was resolved to 5.5.0, which depends on
      rails (>= 4.1)

在这种情况下也是:5.0.7.2 应该满足 rails (>= 4.1).

我不确定我在这里遗漏了什么。非常感谢任何帮助。

rails 升级可能一团糟……您可以尝试将每个 gem 添加到“捆绑包更新”调用中……当我从 5.0.7.2 更新到 6.1 时。 6 我最终得到了这个...

bundle update bootstrap-kaminari-views devise_lastseenable leather simple_calendar where_exists rspec-expectations rspec-rails prawnto_2 validates_overlap slim-rails active_model_serializers grape-active_model_serializers jbuilder has_scope spring-commands-rspec pluck_to_hash tracking_number kaminari font-awesome-sass sinatra spring devise_masquerade

所以,你可以开始做

bundle update mongoid rails

此外,您可能需要检查 gem 的哪些版本与您要安装的 rails 版本兼容,因此您可能需要“锁定”某些 gems到某个版本才能更新成功