“Add 'gem sqlite3'' to your Gemfile”

Hello World!

I'm a complete n00b on Rails with only beginner knowledge of Ruby. I plan on studying Ruby more before I really learn Rails, but I'm waayy too curious for my own good.

Anyway, I was following the 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." So 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.

If it helps, I got Ruby 2.0, Rails 4.0, sqlite3 1.3.7

I apologize if this was answered already somewhere else, but I couldn't find anything in the vast database that is stackoverflow. I would appreciate any patience that you are willing to provide.

Thank you very much! hewhocomes

Hello World!

I'm a complete n00b on Rails with only beginner knowledge of Ruby. I plan on studying Ruby more before I really learn Rails, but I'm waayy too curious for my own good.

Anyway, I was following the tutorial,

Which tutorial and what Operating System are you using (Windows 7, Ubuntu etc)?

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." So I quit the server, installed sqlite3,

It did not say to install sqlite3 (though this may be necessary) it said to add it to Gemfile. In fact you may just have to uncomment it in Gemfile. You should then run bundle install which should install the gem. I am surprised the tutorial did not cover this, assuming that it is a Rails 4 tutorial.

Colin

Hi Colin,

Thank you for your quick reply!

I am using Windows 7. Ruby works fine as I've been using cmd prompt and irb to experiment with Ruby. The tutorial is "Getting Started with Rails" (Getting Started with Rails — Ruby on Rails Guides). I got stuck at the beginning of 4. Hello, Rails!.

When I initially tried to install rails, it failed and asked me to download the DevKit. I followed all the instructions on that correctly. Then I tried installing rails again and it had a bunch of "could not convert ASCII-8BIT to UTF-8" and skipped those files. It wasn't until I got stuck with this error (see post above) that I installed sqlite3. When I installed sqlite3, it said something about being added to Gemfile list (if I remember right). I still don't see it when I do gem list.

I did discover sqlite3 in Gemfile.lock and the text: "# Use sqlite3 as the database for Active Record gem 'sqlite3'" in Gemfile in the root directory of the blog the tutorial asked me to make.

Thanks once again!

Hi Colin,

Thank you for your quick reply!

I am using Windows 7.

Most RoR developers use Linux (eg Ubuntu) or Mac. I believe it is possible to use Windows but you will find it more difficult to get support as so few use it. I advise using Ubuntu either by dual booting the PC or running it in a virtual machine.

I usually recommend railstutorial.org for beginners.

Ruby works fine as I've been using cmd prompt and irb to experiment with Ruby. The tutorial is "Getting Started with Rails" (Getting Started with Rails — Ruby on Rails Guides). I got stuck at the beginning of 4. Hello, Rails!.

When I initially tried to install rails, it failed and asked me to download the DevKit. I followed all the instructions on that correctly. Then I tried installing rails again and it had a bunch of "could not convert ASCII-8BIT to UTF-8" and skipped those files. It wasn't until I got stuck with this error (see post above) that I installed sqlite3. When I installed sqlite3, it said something about being added to Gemfile list (if I remember right). I still don't see it when I do gem list.

I suspect the encoding issues are Windows problems.

I did discover sqlite3 in Gemfile.lock and the text: "# Use sqlite3 as the database for Active Record gem 'sqlite3'" in Gemfile in the root directory of the blog the tutorial asked me to make.

I don't quite understand what you are saying above. You should not edit Gemfile.lock, you should edit Gemfile. Then run bundle install in a terminal. That should install the gem and update Gemfile.lock. However, since you are using Windows, I don't know whether there are other issues.

Colin

Installing on OSX gives a batch of encoding errors as well. They're all rdoc-related, and I've always just ignored them, but they'd be concerning to a newbie--especially one who's having trouble getting started :wink:

Hi guys,

Thanks again for the replies. I did a bundle install. When I did the command, "bundle show sqlite3", it replies with, "Could not find gem 'sqlite3'. Did you mean sqlite3?"

What I meant earlier is the following:

Gemfile has the following text: # Use sqlite3 as the database for Active Recordgem 'sqlite3'

I only have Notepad to view this information, so it just looks like a long line of text.

Gemfile.lock has the following text: sqlite3 (1.3.7-x86-mingw32)

I also the following text in Gemfile.lock: sqlite3

This files already had this text here without me doing anything.

It would be my preference to not have to learn an entire OS just because I want to be able to program. I understand that people have strong preferences and that if I understand more of what I'm doing and how computers work, then I too may develop said preferences. Right now, I just want to play with Rails and Ruby. That's all...nothing fancy. If those who made it say it works on Windows, it works on Windows.

Thanks again!

It does work on Windows, but very few people use it on Windows, so very few people will be able to help you with Windows-specific questions.

Although, once you get started, that won't matter nearly as much.

There's a quick guide on how to install Sqlite3 on Windows 7 here:

I followed the instructions on there, and after a few minor tweaks, I managed to get it working.

I've tried to attach a zip with the necessary files in. Hopefully if you can download that you can drop it into a folder like c:/rails, making it c:/rails/sqlite, and then run this command:

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:/rails/sqlite/include --with-sqlite3-lib=c:/rails/sqlite/lib --with-sqlite3-dir=c:/rails/sqlite/bin

Sometimes running "bundle install" on a Rails project can install a conflicting version of the sqlite gem, so make sure you've only got 1 version after using bundle.

It helps to put sqlite3.def and sqlite3.dll somewhere in your path, like in your Ruby bin folder.

Attachments: http://www.ruby-forum.com/attachment/8552/sqlite.zip

It works! It works!

Thank you, Mr. Pearson. I was able to download your sqlite files and follow your instructions and it worked. I had trouble using the guide you linked. The directions were clear, but my environment didn't like the filed it extracted because it couldn't find the libversion_number file. Your attachment worked, though! It's a shame that sqlite.com doesn't provide these files.

Thank you very much for your clear instructions! I linked this topic on my question in stackoverflow to show other how it works on Windows.

Rails shows me the appropriate Welcome screen and everything! Thank you very much everyone, for giving this n00b advice and direction! I do feel like I understand how Ruby and Rails word on my system a little better.

Thank you! hewhocomes

No problem, we're here to help :slight_smile:

I had the same troulbe on Windows7-x64 even I made everything according to https://www.ruby-forum.com/topic/4413168

Then I opened Gemfile.lock file and just edit this row to “sqlite3 (1.3.7-x64-mingw32)” and run server again - it worked correct. Hope it will help somebody

"Константин Медведев" <k.p.medvedev@gmail.com> wrote in post #1116282: