I'm trying to upload a localhost server with my application's rails, but I'm having this problem with my sqlite3 gem
Infos
Ruby version: 3.2.0
Rails version: 7.1.3.4
SqliteGem: 2.0
Version show in Gem error: sqlite3 1.4
rails s
=> Booting WEBrick
=> Rails 7.1.3.4 application starting in development http://localhost:3000
=> Run `bin/rails server --help` for more startup options
[2024-06-05 14:04:59] INFO WEBrick 1.8.1
[2024-06-05 14:04:59] INFO ruby 3.2.0 (2022-12-25) [x86_64-linux]
[2024-06-05 14:04:59] INFO WEBrick::HTTPServer#start: pid=380133 port=3000
127.0.0.1 - - [05/Jun/2024:14:05:02 -03] "GET / HTTP/1.1" 200 0
- -> /
[2024-06-05 14:05:02] ERROR LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.2-x86_64-linux-gnu. Make sure all dependencies are added to Gemfile.
/home/elton/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/rubygems_integration.rb:237:in `block (2 levels) in replace_gem'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `<top (required)>'
<internal:/home/elton/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/home/elton/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.15/lib/zeitwerk/kernel.rb:34:in `require'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:333:in `resolve_pool_config'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:134:in `establish_connection'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/connection_handling.rb:53:in `establish_connection'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/railtie.rb:304:in `block (2 levels) in <class:Railtie>'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:77:in `each'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/base.rb:338:in `<module:ActiveRecord>'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/base.rb:15:in `<top (required)>'
<internal:/home/elton/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/home/elton/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.15/lib/zeitwerk/kernel.rb:34:in `require'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/query_cache.rb:29:in `run'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/execution_wrapper.rb:29:in `before'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:202:in `block (2 levels) in halting'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:707:in `block (2 levels) in default_terminator'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:706:in `catch'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:706:in `block in default_terminator'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:203:in `block in halting'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:598:in `block in invoke_before'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:598:in `each'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:598:in `invoke_before'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:109:in `run_callbacks'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/execution_wrapper.rb:129:in `run'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/execution_wrapper.rb:125:in `run!'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/execution_wrapper.rb:78:in `block in run!'
<internal:kernel>:90:in `tap'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/execution_wrapper.rb:75:in `run!'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/static.rb:25:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/bundler/gems/rack-8d7c029ed113/lib/rack/sendfile.rb:114:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/host_authorization.rb:141:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.1.3.4/lib/rails/engine.rb:536:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rack-cors-2.0.2/lib/rack/cors.rb:102:in `call'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run'
/home/elton/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread'
My gemfile, I already set sqlite3 updated version, but it shows the error anyway
source 'https://rubygems.org'
ruby '3.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.1'
gem 'rack-cors'
gem 'mailgun-ruby', '~>1.2.5'
gem 'rack-timeout'
gem 'bcrypt', '3.1.12'
group :development, :test do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'colorize'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'bundler-audit'
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# 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 'listen', '~> 3.3'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data'
gem "importmap-rails", "~> 1.1"
gem "hotwire-rails", "~> 0.1.3"
gem "tailwindcss-rails", "~> 2.6"
gem 'rack', git: 'https://github.com/rack/rack'
gem "rackup", "~> 2.1"
# Use Puma as the app server
gem "passenger", "~> 6.0"
gem "recaptcha", "~> 5.16"
gem 'sqlite3', '~> 2.0', '>= 2.0.2'
I need to fix this problem by setting a single sqlite3 gem
Can't use sqlite3 v2
because db adapters explicitly limit the version:
gem "sqlite3", "~> 1.4"
Best explanation that I could find for this:
lean on rubygems to provide error messages about missing gems
https://github.com/rails/rails/commit/146474256cf2f09f9706980032688b2c7d484e24