“Add 'gem sqlite3'' to your Gemfile”

645 views
Skip to first unread message

Matt Hall

unread,
Jun 27, 2013, 4:31:23 PM6/27/13
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Jun 27, 2013, 4:40:57 PM6/27/13
to rubyonra...@googlegroups.com
On 27 June 2013 21:31, Matt Hall <li...@ruby-forum.com> wrote:
> 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

> 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
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c5994b23f548b63620e21a2286b75b1a%40ruby-forum.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Matt Hall

unread,
Jun 27, 2013, 4:54:11 PM6/27/13
to rubyonra...@googlegroups.com
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" (http://guides.rubyonrails.org/getting_started.html). 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!

Colin Law

unread,
Jun 27, 2013, 5:12:48 PM6/27/13
to rubyonra...@googlegroups.com
On 27 June 2013 21:54, Matt Hall <li...@ruby-forum.com> wrote:
> 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" (http://guides.rubyonrails.org/getting_started.html). 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

Scott Ribe

unread,
Jun 27, 2013, 5:57:08 PM6/27/13
to rubyonra...@googlegroups.com
On Jun 27, 2013, at 3:12 PM, Colin Law wrote:

> I suspect the encoding issues are Windows problems.

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 ;-)

--
Scott Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




Matt Hall

unread,
Jun 27, 2013, 6:53:20 PM6/27/13
to rubyonra...@googlegroups.com
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!

Scott Ribe

unread,
Jun 27, 2013, 11:30:23 PM6/27/13
to rubyonra...@googlegroups.com
On Jun 27, 2013, at 4:53 PM, Matt Hall wrote:

> If
> those who made it say it works on Windows, it works on Windows.

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.

Joel Pearson

unread,
Jun 30, 2013, 7:56:22 AM6/30/13
to rubyonra...@googlegroups.com
There's a quick guide on how to install Sqlite3 on Windows 7 here:

http://www.ruby-forum.com/topic/4413168

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

Matt Hall

unread,
Jul 1, 2013, 1:10:21 PM7/1/13
to rubyonra...@googlegroups.com
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.

http://stackoverflow.com/questions/17350837/ruby-on-rails-add-gem-sqlite3-to-your-gemfile/17409859

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!

Joel Pearson

unread,
Jul 1, 2013, 2:37:49 PM7/1/13
to rubyonra...@googlegroups.com
No problem, we're here to help :)

Константин Медведев

unread,
Jul 21, 2013, 7:51:03 AM7/21/13
to rubyonra...@googlegroups.com
On Friday, 28 June 2013 02:53:20 UTC+4, Ruby-Forum.com User wrote:
Hi guys,

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 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

Ison Daya

unread,
Aug 20, 2013, 4:08:15 PM8/20/13
to rubyonra...@googlegroups.com
"Константин Медведев" <k.p.me...@gmail.com> wrote in post #1116282:
That helped so much. I don't know why it was insisting on using the x86
version, which of course didn't exist.
Reply all
Reply to author
Forward
0 new messages