【问题标题】:Bundler not finding current ActiveModel when updating Rails更新 Rails 时,Bundler 找不到当前的 ActiveModel
【发布时间】:2018-10-26 22:57:05
【问题描述】:

尝试将 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

【问题讨论】:

  • 您是否尝试使用 gem pristine --all 获取您的 gemset 的新副本?
  • simple_form 需要低于 5.2 的版本,而 rails 需要 5.2.1 的版本,查看 simple_form 文档,也许您需要同时更新 rails 和 simple_form

标签: ruby-on-rails bundler activemodel


【解决方案1】:

您使用的是 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 的 repo 以检查您是否拥有最新版本。 (或至少一个兼容的)

【讨论】:

    猜你喜欢
    • 2019-05-01
    • 2014-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-10
    • 2022-08-14
    • 1970-01-01
    相关资源
    最近更新 更多