Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sqlite3 gem not loading, gem installed and specified in project

So in my quest to get a ruby dev environment working, I've ran into an issue that seems...confusing to this ruby noob.

When executing rails server, it starts up as expected, but when you put in localhost:3000 to your standard web browser, it replies the following:

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

Now here's the confusing part. I have sqlite3 installed (the 64 bit version, as that is what I downloaded, and am running a 64 bit OS), as verified by gem query (here's the full list of gems)

Gems

Uninstalling and reisntalling didn't do a lick of good for the issue at hand, but it did install without a hitch. Also the gemfile for the project that I'm testing this with is the folliwing

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

As you can see, sqlite3 is specified in the Gemfile quite early on, yet for whatever reason when I try to load the main page, it acts like it's not there.

Particulars for this machine are the following that weren't mentioned earlier in the gems section:

Rails 4 Ruby 2 Windows 7

Anyone ever ran into this before?

like image 477
canadiancreed Avatar asked Sep 02 '13 16:09

canadiancreed


1 Answers

I just had this issue too. Go into your Gemfile.lock file and search for the 'sqlite3' entry. You'll note it reads sqlite3 (1.3.8-x86-mingw32). Change that to sqlite3 (1.3.8-x64-mingw32) and then run the bundle install command and everything should work like normal.

like image 145
Angel Avatar answered Oct 13 '22 09:10

Angel