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

3

从Rails 4.2.8升级到Rails 5.0.2会导致以下错误消息。我不确定如何解决依赖关系。Ruby版本是2.5.1。我已经能够使用Rails 4.2.8运行此应用程序和测试套件,尽管我看到了一些低版本的carrierwave的过度打印,所以我想升级它,但这需要Rails 5。

错误消息

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    actionpack-action_caching was resolved to 1.2.0, which depends on
      actionpack (< 6, >= 4.0.0)

    rails (= 5.0.2) was resolved to 5.0.2, which depends on
      actionpack (= 5.0.2)

    simple_form was resolved to 4.1.0, which depends on
      actionpack (>= 5.0)

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

    rails (= 5.0.2) was resolved to 5.0.2, which depends on
      activemodel (= 5.0.2)

    simple_form was resolved to 4.1.0, which depends on
      activemodel (>= 5.0)

    validate_url was resolved to 1.0.8, which depends on
      activemodel (>= 3.0.0)

Bundler could not find compatible versions for gem "activerecord":
  In Gemfile:
    friendly_id (~> 5.1.0) was resolved to 5.1.0, which depends on
      activerecord (>= 4.0.0)

    rails (= 5.0.2) was resolved to 5.0.2, which depends on
      activerecord (= 5.0.2)

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

    carrierwave was resolved to 2.0.0, which depends on
      activesupport (>= 5.0.0)

    rails (= 5.0.2) was resolved to 5.0.2, which depends on
      activesupport (= 5.0.2)

Bundler could not find compatible versions for gem "http":
  In Gemfile:
    http

    twitter (~> 5.15.0) was resolved to 5.15.0, which depends on
      http (< 0.10, >= 0.4)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (= 5.0.2)

    interactor-rails (~> 2.0) was resolved to 2.2.0, which depends on
      rails (< 5.3, >= 4.2)

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 5.0.2) was resolved to 5.0.2, which depends on
      railties (= 5.0.2)

    sass-rails (~> 5.0.1) was resolved to 5.0.8, which depends on
      railties (>= 5.2.0)

Bundler could not find compatible versions for gem "sprockets":
  In Gemfile:
    sprockets

    sass-rails (~> 5.0.1) was resolved to 5.0.8, which depends on
      sprockets (< 4.0, >= 2.8)

Gemfile

source 'https://rubygems.org'

ruby '2.5.1'

gem 'actionpack-action_caching'
gem 'active_hash', '~> 1.4.1'
gem 'avatars.io'
gem 'aws-sdk-s3', '~> 1'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'coffee-rails', '~> 4.0.0'
gem 'compass-rails', '~> 2.0.2'
gem 'dalli'
gem 'devise'
gem 'diffy'
gem 'font-awesome-rails'
gem 'fog'
gem 'foundation-rails', '~> 5.5.3.2'
gem 'friendly_id', '~> 5.1.0'
gem 'haml'
gem 'html5shiv-js-rails'
gem 'http'
gem 'interactor-rails', '~> 2.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'pg'
gem 'puma', '~> 3.11.4'
gem 'rails', '5.0.2'
gem 'redcarpet'
gem 'rmagick'
gem 'ruby-mp3info', '>= 0.8.4'
gem 'sass-rails', '~> 5.0.1'
gem 'sidekiq'
gem 'sinatra', require: false
gem 'simple_form'
gem 'sprockets'
gem 'stamp'
gem 'twitter', '~> 5.15.0'
gem 'uglifier', '>= 1.3.0'
gem 'validate_url'
gem 'xml-simple', '~> 1.1.5'
gem 'will_paginate'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'quiet_assets'
end

group :production do
  gem 'rails_12factor'
  gem 'scout_apm'
  gem 'sentry-raven'
  # gem 'unicorn-worker-killer'
end

group :test do
  gem 'factory_girl_rails'
  gem 'm'
  gem 'minitest-rails', '~> 2.2.0'
  gem 'simplecov', '~> 0.9', require: false
  gem 'timecop'
end

group :development, :test do
  gem 'dotenv-rails'
  gem 'pry'
  gem 'awesome_print'
end


我认为这是因为你正在修复许多 gem 的版本,这些版本无法通过运行 bundle 自动解决。尝试删除错误 gem 的固定版本,然后再试一次。 - quyetdc
你尝试如何更新到Rails 5.0.2?你采取了哪些步骤,运行了什么命令? - spickermann
2个回答

1
    sass-rails (~> 5.0.1) was resolved to 5.0.8, which depends on
      railties (>= 5.2.0)

railties 5.2将与Rails的其余部分在5.0上产生冲突 - 您需要将sass-rails限制为< 5.0.8


0

首先备份您的Gemfile,然后尝试使用以下命令

source 'https://rubygems.org'

ruby '2.5.1'

gem 'actionpack-action_caching'
gem 'active_hash'
gem 'avatars.io'
gem 'aws-sdk-s3'
gem 'bootstrap-sass'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'coffee-rails'
gem 'compass-rails'
gem 'dalli'
gem 'devise'
gem 'diffy'
gem 'font-awesome-rails'
gem 'fog'
gem 'foundation-rails'
gem 'friendly_id'
gem 'haml'
gem 'html5shiv-js-rails'
gem 'http'
gem 'interactor-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'pg'
gem 'puma'
gem 'rails'
gem 'redcarpet'
gem 'rmagick'
gem 'ruby-mp3info'
gem 'sass-rails'
gem 'sidekiq'
gem 'sinatra', require: false
gem 'simple_form'
gem 'sprockets'
gem 'stamp'
gem 'twitter'
gem 'uglifier'
gem 'validate_url'
gem 'xml-simple'
gem 'will_paginate'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'quiet_assets'
end

group :production do
  gem 'rails_12factor'
  gem 'scout_apm'
  gem 'sentry-raven'
  # gem 'unicorn-worker-killer'
end

group :test do
  gem 'factory_girl_rails'
  gem 'm'
  gem 'minitest-rails'
  gem 'simplecov', require: false
  gem 'timecop'
end

group :development, :test do
  gem 'dotenv-rails'
  gem 'pry'
  gem 'awesome_print'
end

运行

bundle update

但是他们想要Rails 5.0.2。 - smathy
将Rails gem添加到您的gem文件中 "gem 'rails','5.0.2'",然后尝试命令:- gem install rails -v '5.0.2',然后尝试命令:- bundle install。您是否在使用gemset? - Ashok Damaniya

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接