0

从 Rails 4.2.10 升级到 Rails 5.1.4 会导致以下错误消息。我不确定如何解决依赖关系。红宝石版本是 2.5.1。Rails 4.2.10 运行没有问题并且bundle upgrade运行没有返回任何错误。

更新:在下面添加了 Gemfile 以供参考。Gemfile.lock在执行之前删除时bundle update,仍然会生成以下错误消息。

错误信息

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    rails (~> 5.1.4) was resolved to 5.1.4, which depends on
      activemodel (= 5.1.4)

web-console (~> 2.0.0.beta3) was resolved to 2.0.0, which depends on
  activemodel (~> 4.0)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    jbuilder (~> 2.7.0) was resolved to 2.7.0, which depends on
  activesupport (>= 4.2.0)

rails (~> 5.1.4) was resolved to 5.1.4, which depends on
  activesupport (= 5.1.4)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (~> 5.1.4)

Could not find gem 'rails (~> 5.1.4)' in any of the sources.Bundler could not 
find compatible versions for gem "activemodel":
  In Gemfile:
    rails (~> 5.1.4) was resolved to 5.1.4, which depends on
      activemodel (= 5.1.4)

web-console (~> 2.0.0.beta3) was resolved to 2.0.0, which depends on
  activemodel (~> 4.0)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
jbuilder (~> 2.7.0) was resolved to 2.7.0, which depends on
  activesupport (>= 4.2.0)

rails (~> 5.1.4) was resolved to 5.1.4, which depends on
  activesupport (= 5.1.4)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
rails (~> 5.1.4)

Could not find gem 'rails (~> 5.1.4)' in any of the sources.

宝石文件

source 'https://rubygems.org'

gem 'rails', '~> 5.1.4'
gem 'sass-rails'
gem 'bootstrap-sass'
gem 'bcrypt'
gem 'uglifier',     '~> 3.2.0'
gem 'coffee-rails', '~> 4.2.2'
gem 'jquery-rails', '~> 4.3.1'
gem 'turbolinks',   '~> 5.0.1'
gem 'jbuilder',     '~> 2.7.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'stripe'

group :development, :test do
  gem 'sqlite3',     '~> 1.3.9'
  gem 'byebug',      '~> 3.4.0'
  gem 'web-console', '~> 2.0.0.beta3'
  gem 'spring',      '~> 1.1.3'
end

group :test do
  gem 'minitest-reporters', '~> 1.0.5'
  gem 'mini_backtrace',     '~> 0.1.3'
  gem 'guard-minitest',     '~> 2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'puma'
end
4

1 回答 1

1

gem web-console 正在锁定您的更新过程,首先将其更改为更新的版本,例如:

gem 'web-console', '>= 3.3.0'

然后删除Gemfile.lock并运行bundle install也总是可以检查其他 gem 的版本并检查http://guides.rubyonrails.org/upgrading_ruby_on_rails.html中的官方 Rails 升级过程文档

于 2018-06-17T05:27:52.017 回答