Ruby Ruby on Rails 5 Basics Creating an App Creating a Rails App

anthonybrackner
anthonybrackner
17,776 Points

Getting Sqlite Error after entering "bin/rails server"

I am on windows, using the Ubuntu command prompt. After entering "bin/rails server", I get the following error: #<LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3.

Any ideas on how to fix this?

obi
obi
742 Points

I had a similar problem, though not exactly the same (am on MacOS). My server would boot up, but trying to load a page would result in:

Gem::LoadError (Specified 'sqlite3' for database adapter, but the gem is not loaded. Addgem 'sqlite3'to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).):

This reddit post helped me:

There was a recent sqlite3 1.4.0 release which broke current Rails 5.2, which enforces 1.3.x.

https://www.reddit.com/r/rails/comments/ap36xe/specified_sqlite3_for_database_adapter_but_the/

In my case, the following steps worked:

  1. Replace gem 'sqlite3' with gem 'sqlite3', '~> 1.3.0 ' in your Gemfile
  2. Remove Gemfile.lock
  3. Run bundle install again

1 Answer

anthonybrackner
anthonybrackner
17,776 Points

Thanks obi, managed to get this one straightened out.