Ruby on Rails - "Add 'gem sqlite3'' to your Gemfile"

hewhocomes picture hewhocomes · Jun 27, 2013 · Viewed 71.2k times · Source

I was following the Rails tutorial, but I got stuck when it said to type rails server in the blog directory. It states

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile.

I quit the server, installed sqlite3, reinstated the server, only to get this message again. sqlite3 doesn't show up when I do gem list, but I do see the folder in my Root Ruby directory.

How can I fix this error?

I'm using Ruby 2.0, Rails 4.0, sqlite3 1.3.7.

Answer

Paul picture Paul · Jun 29, 2013

I had this error appear with the same version of Ruby / Rails / SQLite that you specified in your question even after confirming that my gemfile has gem 'sqlite3'. I don't know what OS you have (which is why you were down-voted probably) but I am using Windows 7 x64.

In order to get the gem to be installed in my Rails application, I needed to edit the Gemfile.lock file to replace sqlite3 (1.3.7-x86-mingw32) with sqlite3 (1.3.7)

Then, after running bundle install I finally see in the output

Using sqlite3 (1.3.7)

Upon running rails server, I (finally) see the "Welcome aboard" page.