Home > OS >  Rails update from 6.1 to 7.0.4 Gem dependencies issues
Rails update from 6.1 to 7.0.4 Gem dependencies issues

Time:11-09

I was trying to update my rails app from Rails 6.1 to 7.0.4.

When I try to bundle install after updating rails and ruby on my gemfile. I couldn't find any gem version to change on my gemfile.

Here's my 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]

And here's the error I always get :

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)

I've tried to reinstall bundle and each gems by looking at the dependencies showed here : https://rubygems.org/gems/rails/versions/7.0.4/dependencies.

After many researchs, I coudln't find a way to unlock the situation, each tries leads to the dependencies error showed earlier.

CodePudding user response:

Actionpack and activerecord are bundled directly with rails, so it updates alongside.

simple_token_authentication is dependent on an earlier version of rails, so you need to update it as well.

It appears to be dependent in <5 which is odd considering you say you’re updating from 6.1, but I’ll assume your bundle functioned before.

However, it looks like you’re using the latest version, so your options are to find a different gem or wait for the gem to be updated.

  • Related