skip to Main Content

I’m trying to create new app using ruby 3 and rails 7, getting this error while starting the server.

Here is my Gemfile:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.0.0"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 6.0.4.4"

# Use sqlite3 as the database for Active Record
gem "pg"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
# gem "jbuilder"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem "rack-cors"

group :development, :test do
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  gem "debug", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
end

gem 'devise'

gem 'cssbundling-rails'

gem 'mini_magick', '>= 4.9.5'

gem 'carrierwave', '~> 0.9'

gem 'bootstrap-sass','~> 2.3.2'

# gem 'activeadmin'
gem 'sass-rails'

I am trying to copy my old project which is built on ruby 2 and rails 7.

2

Answers


  1. Maybe if you change your gemfile version by deleting your gemfile.lock and then uninstalling this version 6.0.4.4 as the error path shows us running trying to use this old version

    gem 'rails', '~> 7.0', '>= 7.0.2.3' # Gemfile
    
    gem uninstall rails
    gem uninstall railties
    
    # for example
    
    gem install rails -v 7.0.2.3 
    # or only
    bundle
    

    and make sure…

    config.load_defaults 7.0 # application.rb
    
    class ... < ActiveRecord::Migration[7.0] # db/migrate/*.rb
    
    Login or Signup to reply.
  2. Please make sure the correct rails version is mentioned in file configapplication.rb

    config.load_defaults rails_version you want to use

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search