can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0

Juan Rodriguez picture Juan Rodriguez · Feb 5, 2019 · Viewed 18.9k times · Source

I’m using Ubuntu and run into to a problem when using db:migrate for ruby project.

rails aborted!
LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile.
/home/juan/odin_on_rails/RailsaAPP/bin/rails:9:in `<top (required)>'
/home/juan/odin_on_rails/RailsaAPP/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
Gem::LoadError: can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile.
/home/juan/odin_on_rails/RailsaAPP/bin/rails:9:in `<top (required)>'
/home/juan/odin_on_rails/RailsaAPP/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)

Answer

Saral Karki picture Saral Karki · Feb 5, 2019

I had a similar issue today. Here's what worked for me. I tried using Michael's approach but received a similar error.

So instead, I removed the gem that I thought was giving me an error, by gem uninstall sqlite3 -v 1.4.0

and instead, used in my gem file. gem 'sqlite3', '~> 1.3.6' Ran the bundle update and it worked like a charm for me.