首页 > 解决方案 > 从 rails 5.1 升级到 5.2 时,如何更新 Gemfile?

问题描述

我正在尝试将我的 rails 应用程序从 5.1.4 升级到 5.2。

我已经完成了这里的步骤: https ://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-5-1-to-5-2.html

但是,这完全跳过了如何更新 gemfile。

当我改变

gem 'rails', '~> 5.1.4'

gem 'rails', '~> 5.2.2'

我收到错误:

Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (= 5.1.6.1)

  In Gemfile:
    rails (~> 5.2.2) was resolved to 5.2.2, which depends on
      activesupport (= 5.2.2)

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

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

我可以解决这些错误,但这似乎是一种不完整的更新方式。

更新 gemfile 的正确方法是什么?

标签: ruby-on-rails

解决方案


bundle update rails

在此之后,您可以使用 gem "bundleup" 查看可以更新的其他 gem。


推荐阅读