Rails从6.1更新到7.0.4 Gem依赖问题



我试图将我的rails应用程序从rails 6.1更新到7.0.4。

当我尝试在我的gemfile上更新rails和ruby后捆绑安装。我无法在我的gemfile中找到任何可以更改的gem版本。

这是我的gemfile:


ruby "3.1.2"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem "rails", "~> 7.0.4"
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
gem 'activerecord', '>= 7.0.4'
gem 'actionpack', '>= 7.0.4'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
gem 'devise'
gem 'pundit'
gem 'simple_token_authentication'
gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 6.1'
gem 'simple_form'
# Charts
gem "chartkick"
# Generateur de PDF
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
gem 'wkhtmltopdf-heroku', '2.12.6.0'
# Editeur de texte
gem 'ckeditor', github: 'galetahub/ckeditor'
gem "mini_magick"
gem "select2-rails"
gem 'select2_simple_form', github: 'lndl/select2_simple_form', tag: '0.7.3'
gem 'sidekiq'
gem 'sidekiq-failures', '~> 1.0'
# Cloud Storage
gem "aws-sdk-s3", require: false
gem "down"
gem "image_processing", ">= 1.2"
# transform file via zip
gem 'rubyzip', '>= 1.0.0'
gem 'zip-zip'
# XML reader
gem 'nokogiri', '~> 1.6', '>= 1.6.6.2'
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'dotenv-rails'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 4.1.0'
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem 'rack-mini-profiler', '~> 2.0'
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.26'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

我总是得到这样的错误:

Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
rails (~> 7.0.4) was resolved to 7.0.4, which depends on
actionpack (= 7.0.4)
simple_token_authentication was resolved to 1.13.0, which depends on
actionpack (< 5, >= 3.2.6)
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
rails (~> 7.0.4) was resolved to 7.0.4, which depends on
activerecord (= 7.0.4)
simple_token_authentication was resolved to 1.5.2, which depends on
activerecord (< 5, >= 3.2.6)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 7.0.4)
simple_token_authentication was resolved to 1.0.0.pre.beta.2, which depends on
rails (~> 4.0.0)

我已经尝试重新安装bundle和每个gems通过查看这里显示的依赖关系:https://rubygems.org/gems/rails/versions/7.0.4/dependencies.

经过多次研究,我无法找到解决问题的方法,每次尝试都会导致前面显示的依赖错误。

Actionpackactiverecord直接与rails绑定,因此它会同步更新。

simple_token_authentication依赖于rails的早期版本,所以你也需要更新它。

它似乎依赖于<5,考虑到你说你是从6.1更新的,这很奇怪,但我假设你的bundle以前运行过。

但是,看起来你使用的是最新版本,所以你的选择是找到一个不同的gem或等待gem更新。

最新更新