Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a valid gem install activerecord-sqlite3-adapter

I'm a beginner to Ruby. I follow the steps on http://rubyonrails.org/download and installed Ruby on rails and created a project called "Blog" by following the youtube tutorial. http://www.youtube.com/watch?v=UQ8_VOGj5H8

But whenever I used the command rails s, it will give an error:

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/rubygems_integ
ration.rb:214:in `block in replace_gem': Please install the sqlite3 adapter: `ge
m install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add
it to Gemfile.) (LoadError)

This is happening to both of my laptop and PC, both are using Windows 7. I tried to run the command gem install activerecord-sqlite3-adapter, but then I gives me the error.

C:\Users\Ouye\blog>gem install activerecord-sqlite3-adapter
ERROR:  Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any
repository
ERROR:  Possible alternatives: activerecord-jdbcsqlite3-adapter, activerecord-sq
lserver-adapter, activerecord-bq-adapter, activerecord-simpledb-adapter, activer
ecord-mysql2-adapter

I tried all of the alternatives above and update my bundle install, some of the alternatives works and some don't. After I tried all of the alternatives above and run "rails s", I still get the same error of telling me to install sqlite3 adapter.

This is what my gem file looks like

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'sqlite3'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

And this is all bundles in the gem

Gems included by the bundle:
  actionmailer (3.2.13)
  actionpack (3.2.13)
  activemodel (3.2.13)
  activerecord (3.2.13)
  activeresource (3.2.13)
  activesupport (3.2.13)
  arel (3.0.2)
  builder (3.0.4)
  bundler (1.3.5)
  coffee-rails (3.2.2)
  coffee-script (2.2.0)
  coffee-script-source (1.6.2)
  erubis (2.7.0)
  execjs (1.4.0)
  hike (1.2.2)
  i18n (0.6.1)
  journey (1.0.4)
  jquery-rails (2.2.1)
  json (1.7.7)
  mail (2.5.3)
  mime-types (1.23)
  multi_json (1.7.3)
  polyglot (0.3.3)
  rack (1.4.5)
  rack-cache (1.2)
  rack-ssl (1.3.3)
  rack-test (0.6.2)
  rails (3.2.13)
  railties (3.2.13)
  rake (10.0.4)
  rdoc (3.12.2)
  sass (3.2.9)
  sass-rails (3.2.6)
  sprockets (2.2.2)
  thor (0.18.1)
  tilt (1.4.1)
  treetop (1.4.12)
  tzinfo (0.3.37)

I would be very grateful if anyone can solve my problem.

like image 458
Ohhh Avatar asked May 12 '13 23:05

Ohhh


3 Answers

You cannot install activerecord-sqlite3-adapter as a gem, because this adapter is included with ActiveRecord already. The problem is not in activerecord-sqlite3-adapter, but in that you don't have sqlite3 as part of your Gem bundle (the error message tells us this at the end: "sqlite3 is not part of the bundle.")

To fix it, add it to your Gemfile first:

# in your Gemfile
gem 'sqlite3'

then run from command line:

$ bundle install

Ensure that sqlite3 installs correctly and shows up in your Gem bundle, and everything should work.

like image 77
Arman H Avatar answered Nov 17 '22 06:11

Arman H


I had the same issue as you are presenting, and after a lot of trial and error, i found some simple steps to fix it.

First, add to your Gemfile:

gem 'sqlite3', '1.3.5'

Then run in your console:

bundle install

And then you should proceed normally

like image 41
Hans Gamarra De Lima Avatar answered Nov 17 '22 04:11

Hans Gamarra De Lima


Ruby 2.0 has problems with sqlite3 and can't run. If you need to use sqlite3 you'll have to downgrade to 1.9.3. I don't have the link to the documentation about this, but I know if you downgrade to 1.9.3 you'll be fine. I'll see if I can find the link.

like image 2
Major Avatar answered Nov 17 '22 04:11

Major