【问题标题】:How do I update the version of Rails in my project? Bundler could not find compatible versions for gem "activemodel"如何更新项目中的 Rails 版本? Bundler 找不到 gem “activemodel” 的兼容版本
【发布时间】:2019-05-01 21:19:41
【问题描述】:

我不明白这个问题。 Bundler 说它需要activemodel >= 4.2.0、>= 4.0 和 = 5.2.1.rc1。那么为什么不直接选择 5.2.1.rc1 ,因为它满足了所有的依赖关系呢?

对于宝石railsrailties 等有几十个这样的错误。

我正在从 Rails 4.2 升级到最新的 Rails。我注释掉了除 Ruby 和 Rails 之外的所有版本说明符。这是我的整个Gemfile

workspace\>bundle
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rubygems.org/..
You have requested:
  rails ~> 5.2

The bundle currently has rails locked at 4.2.3.
Try running `bundle update rails`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

C:\Users\Chloe\workspace\>bundle update rails
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    paperclip (~> 5.0) x64-mingw32 was resolved to 5.0.0, which depends on
      activemodel (>= 4.2.0) x64-mingw32

    rails (~> 5.2) x64-mingw32 was resolved to 5.2.1.rc1, which depends on
      activemodel (= 5.2.1.rc1) x64-mingw32

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

【问题讨论】:

    标签: ruby-on-rails ruby rubygems bundler


    【解决方案1】:

    首先备份您的Gemfile.lock,然后将其删除并再次尝试执行bundle install

    【讨论】:

    • @meJustAndrew 这似乎是一个宝石/依赖问题,我偶尔会通过尝试我的回答所建议的方法来解决这个问题。我不知道 为什么 OP 会遇到这个问题,但我认为这是 如何 他们可以解决它。
    • 是的,删除 Gemfile.lock 并运行 bundle 修复它并安装所有 gem。
    猜你喜欢
    • 2014-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 2022-08-14
    • 2017-07-17
    • 2018-02-09
    相关资源
    最近更新 更多