Hi I’ve installed the sqlite3-ruby gem via gem install. However
when I do a:
require ‘sqlite3’
I get a LoadError: no such file to load — sqlite3. This is on Mac
OSX 10.5.2. Yes I have slite3 installed and working. I checked the
gems directory and the sqlite3.rb file exists. I’m obviously missing
something obvious.
I get a LoadError: no such file to load — sqlite3. This is on Mac
OSX 10.5.2. Yes I have slite3 installed and working. I checked the
gems directory and the sqlite3.rb file exists. I’m obviously missing
something obvious.
That did it!
Thanks much…told you it was a newbie question
You’re welcome! I had the problem a few month ago, when I installed
Ruby on Windows without admin rights. Had to include that, because the
RUBYOPT enviroment variable didn’t exist. Write -rubygems in it and
you don’t have to require them every time.
When you install a gem you must use RubyGems to load it as well. Did you
enable RubyGems in your pgm before reequiring sqlite3? The simplest
(tho’ least robust) way is to add
require ‘rubygems’
at the top of your program.
You could also add,
export RUBYOPT=rubygems
to your .profile file. This is the solution I use as I avoid having to
type require ‘rubygems’
on every script that has a gem lib file as a dependency.
If you don’t know how to set environment variables in BASH, google would
be a good start.
When you install a gem you must use RubyGems to load it as well. Did you
enable RubyGems in your pgm before reequiring sqlite3? The simplest
(tho’ least robust) way is to add
require ‘rubygems’
at the top of your program.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.