Bundler在更新Rails时找不到当前的ActiveModel

时间:2018-10-26 22:57:06

标签: ruby-on-rails bundler activemodel

尝试将Rails 4.2.9应用程序更新为Rails 5.2.1。更改了Gemfile:

gem 'rails', '5.2.1'

但是Bundler似乎无法找到合适的ActiveModel版本(在Gemfile中的任何地方都没有明确指出)。

我已将下面提到的gem更新为它们的最新版本(active_model_serializersclearancesimple_formsanitizecapybara-angular(至0.2。 5,因为0.2.6超出了规格),并且测试通过了4.2.9)。

不确定如何处理此问题。有想法吗?

$ bundle update rails
  ...
  Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    active_model_serializers (= 0.10.7) was resolved to 0.10.7, which depends on
      activemodel (< 6, >= 4.1)

    clearance (= 1.16.1) was resolved to 1.16.1, which depends on
      email_validator (~> 1.4) was resolved to 1.6.0, which depends on
        activemodel

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

    simple_form (= 3.5.1) was resolved to 3.5.1, which depends on
      activemodel (< 5.2, > 4)

Bundler could not find compatible versions for gem "nokogiri":
  In Gemfile:
    nokogiri (= 1.7.2)

    capybara-angular (= 0.2.5) was resolved to 0.2.5, which depends on
      capybara (>= 2.5.0) was resolved to 2.18.0, which depends on
        nokogiri (>= 1.3.3)

    sanitize (= 4.6.6) was resolved to 4.6.6, which depends on
      nokogumbo (~> 1.4) was resolved to 1.5.0, which depends on
        nokogiri

    sanitize (= 4.6.6) was resolved to 4.6.6, which depends on
      nokogiri (>= 1.4.4)

    capybara-angular (= 0.2.5) was resolved to 0.2.5, which depends on
      capybara (>= 2.5.0) was resolved to 2.18.0, which depends on
        xpath (< 4.0, >= 2.0) was resolved to 2.1.0, which depends on

1 个答案:

答案 0 :(得分:0)

您正在使用simple_form版本3.5.1和Rails 5.2.1。支持Rails 5.2的simple_form的第一个版本是version 4.0

您可以说这是问题所在,因为此行:

simple_form (= 3.5.1) was resolved to 3.5.1, which depends on
  activemodel (< 5.2, > 4)

将simple_form升级到至少4.0.0版本,它将解决此问题。

大多数gem储存库都将包含一个CHANGELOG,用于记录此类兼容性问题,因此,一个好的第一步是访问该gem的存储库,以检查您是否具有最新版本。 (或至少兼容)