【问题标题】:Bundler could not find compatible versions for gem "faraday": Upgrading rails from 4.2 to 5.2.3Bundler 找不到 gem "faraday" 的兼容版本:Upgrading rails from 4.2 to 5.2.3
【发布时间】:2019-10-19 16:37:48
【问题描述】:

我正在尝试将我的 rails 4.2 项目升级到 5.2.3。

在执行 bundle update rails 时,出现以下错误。

Bundler 找不到 gem "faraday" 的兼容版本: 在 Gemfile 中: 法拉第 (~> 0.11.0)

faraday_middleware was resolved to 0.13.1, which depends on
  faraday (>= 0.7.4, < 1.0)

oauth2 (~> 1.3.1) was resolved to 1.3.1, which depends on
  faraday (>= 0.8, < 0.12)

sentry-raven was resolved to 2.9.0, which depends on
  faraday (>= 0.7.6, < 1.0)

twilio-ruby was resolved to 5.23.1, which depends on
  faraday (~> 0.9)

Bundler 找不到 gem "railties" 的兼容版本: 在 Gemfile 中: coffee-rails (~> 4.1.0) 被解析为 4.1.0,这取决于 railties (>= 4.0.0,

devise was resolved to 4.6.2, which depends on
  railties (>= 4.1.0, < 6.0)

factory_bot_rails was resolved to 5.0.2, which depends on
  railties (>= 4.2.0)

rails (= 5.2.3) was resolved to 5.2.3, which depends on
  railties (= 5.2.3)

rails-i18n was resolved to 5.1.3, which depends on
  railties (>= 5.0, < 6)

rspec-rails (~> 3.5, >= 3.5.2) was resolved to 3.8.2, which depends on
  railties (>= 3.0)

sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
  railties (>= 4.0.0, < 6)

web-console (~> 2.0) was resolved to 2.3.0, which depends on
  railties (>= 4.0)

根据参考资料,我删除了 Gemfile.lock 并运行了 bundle install 但出现了同样的错误。

似乎有两个 gem 与当前的库不兼容。您对如何安全地将 rails 项目升级到 5.2.3 有什么建议吗?

【问题讨论】:

  • 只需删除Gemfile.lock 并再次运行bundle install,可能对您有所帮助。
  • 嗨,正如我在上面评论的那样,它没有成功,出现了同样的消息。:(
  • 尝试运行一次bundle update,如果您提到了上述任何 gem 的 gem 版本,请将其从 gemfile 中删除。
  • 这真是个糟糕的建议...尝试通过“删除所有版本限制、删除Gemfile.lock 并运行bundle update”来升级复杂的旧rails 应用程序会引入大量错误.当然,它会安装 gem,但很可能应用程序实际上不会运行。
  • @SungpahLee 恢复到应用程序的工作版本。一次升级一个。确保它仍然有效,每一步。在我看来,您一直在尝试一次性升级很多东西,并且 - 在这样做时 - 您已经编辑了 Gemfile 以指定与您的其他库不兼容的 faraday 的更高版本。

标签: ruby-on-rails ruby


【解决方案1】:

我看到你有两个 gem 依赖问题:

1) 您使用法拉第 (~> 0.11.0),但 twilio-ruby 5.23.1 需要法拉第 (~> 0.9)。所以你需要将你的法拉第版本降级到(~> 0.9)

2) 您使用依赖于 railties (>= 4.0.0, 4.1.0)。但是 rails 5.2.3 使用 railties (5.2.3)。所以你需要将你的咖啡导轨升级到 (~> 5.0.0)

换句话说,在 Gemfile 中你需要更改行:

faraday (~> 0.11.0)
coffee-rails (~> 4.1.0)

收件人:

faraday (~> 0.9)
coffee-rails (~> 5.0.0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-14
    • 2011-10-31
    • 2013-06-30
    • 2019-03-28
    • 2023-03-14
    • 2017-07-17
    相关资源
    最近更新 更多