database & rubygems

Hi everybody!! I use rails 3.0 In my new created project I tried to run it by the command rails -s but it show me that Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources.Try running `bundle install`. even after doing bundle install I've already exactly installed gem Why this error occurred! In my Gemfile in the project I've the line gem 'sqlite3-ruby', :require => 'sqlite3'. I tried to create project with mysql like>> rails new project -d mysql but the problem stay still Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.Try running `bundle install`.

What's wrong please??? Thanks to be pleased to help me, i really need it!!!

Do you have ‘mysql2’ gem installed?? Check your system gems or local gems if using rvm and look for mysql2 gem. I know its not there, so install it by running gem install mysql2.

Thanks for your answer! but gem install mysql2 gives me ERROR, it says me this long message: ERROR :failed to built gem native extensions. /usr/bin/ruby1.8 extconf.rb extconf.rb:2:in 'require': no such file to load --mkmf (LoadError) from extconf.rb:2

Gem files remain installed in /usr/lib/ruby/gems/1.8/gems/mysql2-0.2.6 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out

and I've no idea of what i should do!

Hello Aicha!

Zero: check if your system have these DBs itelf, like sqlite3 and mysql, update them, and all other components which will be used.

First you have to install the gem itself to your system (I think other reply also asked about it, so it's not the Gemfile, it's in your system): (sudo) gem install sqlite3-ruby then check if you can see it: "gem list", or "gem list s".

Also try to start the console with every DB, to be sure they works and you know all passwords you will need later.

If it is ready, without error, then put the line to your Gemfile, bundle install etc. as you did.

May I ask which versions do you use from: Ruby, Rails, Gem, SQLite3, MySQL? Which opertaing system?

As other commenter, I also advice to use RVM: http://rvm.beginrescueend.com/ later you will have less problems with updating.

Hard to start, I had terrible struggle in both systems, so if you need further help feel free to write me in private. Good luck, Zoltán

Thanks Zoltan, and sorry for my not so good english! I'm not sure but it seems to be a problem with in my system! I've both db installed and updated : mysql5.1.41 , sqlite3.6.22! I've ruby1.8.7 , rails3.0.1 and gem1.3.7 too on ubuntu10.4! When I type (sudo) gem install sqlite3-ruby, I've the same previous ERROR but I can see all my gems after typing gem list(including bundler1.0.3)! bundle install command don't return error, it run correctly but even after I can't run my project, always this message"Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources.Try running `bundle install`."

Hard hard yes, but fortunely there is people like u who are ready to encourage others! thank u!

Hey Aicha, don't worry, your English understandable, and everyone was beginner once :wink: just keep trying and not to give up!

I think it would be a good idea to install ruby1.9. A good way for it is using RVM http://rvm.beginrescueend.com/

I see, your databases are on place. If you have ruby1.8 then you will also need sudo gem install libsqlite3-dev . It solved for me with Ruby1.8, but still much better to upgrade Ruby1.9, then it won't be any problem.

Have you checked DBs if you can start console and login? So you know well the username+password, if any? You have to write them to the config/database.yaml file.

Then since it's a Rails3 app, open Gemfile, and write "gem 'sqlite3- ruby', :require => 'sqlite3' ", then bundle install.

Don't give up, let us know if you could solve this and start well with Rails! :wink: Zoltán

lol, thanks! Yep, I'll update my ruby's version! But I thing that I'll use mysql as database, sqlite ask for so much thing, even when I type sudo gem install libsqlite3-dev, I've ERROR: Could not find a valid gem 'libsqlite3-dev' in any repository. Yep, I can start my DB in console and I've written them (login & password) in config/database.yml file too! "gem 'sqlite3-ruby', :require => 'sqlite3' " is in my rails3 project's Gemfile by default but but unfortunely, bundle install still don't solve my problem! I think that I'll remove all (ruby, gems & rails) and install them again! anyway I'll solve it God willing, dont worry too :wink: Kindly, Aicha