升级到Rails 5,无法解决依赖关系

时间:2018-06-16 15:26:26

标签: ruby-on-rails ruby-on-rails-5 rails-upgrade

从Rails 4.2.10升级到Rails 5.1.4会导致以下错误消息。我不确定如何解决依赖关系。 ruby版本是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.

的Gemfile

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

1 个答案:

答案 0 :(得分:0)

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

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

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