views:

1129

answers:

5

This is the first time I am running Ruby on Rails.

When running the "blog" application I got the message "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."

Then I checked the CODE\blog\log\development.log and got this:

/!\ FAILSAFE /!\  Tue Jun 30 15:22:55 +0100 2009
 Status: 500 Internal Server Error
 no such file to load -- sqlite3
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:156:in `require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:521:in `new_constants_in'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:156:in `require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/requires.rb:7:in
`require_library_or_gem'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/requires.rb:5:in
`require_library_or_gem'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/sqlite3_adapter.rb:10:in
`sqlite3_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
   c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
123:in `retrieve_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
115:in `connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/query_cache.rb:9:in `cache'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/query_cache.rb:28:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/head.rb:9:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/methodoverride.rb:24:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/params_parser.rb:15:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/rewindable_input.rb:25:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/session/cookie_store.rb:93:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/reloader.rb:9:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/failsafe.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `synchronize'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:106:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/
static.rb:31:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:46:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `each'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/
log_tailer.rb:17:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/content_length.rb:13:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/handler/webrick.rb:46:in
`service'
   c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
   c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/handler/webrick.rb:13:in `run'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:
111
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
   script/server:3

I have already tried:

gem install sqlite3

And got this response.

ERROR:  could not find gem sqlite3 locally or in a repository

I also tried:

gem install sqlite3-ruby

And got this response.

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
       ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/
sqlite3-ruby-1
.2.4 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/
ext/sqlite3_
api/gem_make.out

I am running Windows XP with XAMPP (Apache + MySQL + PHP).

How can I solve this?

+1  A: 

Windows can be very difficult to configure properly for Ruby add-ons that require compiled extensions, of which SQLite is probably one given the way it is looking for C header files.

Installing the full Cygwin environment, with gcc and nmake included, may help fix some of these problems.

Wherever possible try and find binary versions of the required plugins to avoid problems like this.

A possible reference that might help:

http://domhackers.blogspot.com/2008/09/sqlite3-ruby-gem-on-windows.html

tadman
+3  A: 

Use InstantRails.

It sets up the Windows environment correctly without any hassle.

Once you have installed InstantRails, you can start the GUI by finding the .exe in the install directory. Then click on the "I" icon -> Rails Applications -> Open Ruby Console Window to open a console.

Run "gem update --system" and "gem update rails" to get up to date with the latest RoR since InstantRails is a few years old at this point.

Joe Schneider
http://www.expressionlab.com/2009/1/17/upgrading-instantrails-to-rails-2-2-on-windows That will help if you have any problems doing that upgrade.
Joel Meador
A: 

It's pretty simple once you accept that in the Ruby world, Windows versions tend to lag a bit behind the *nix ones.

There are instructions on the Rails Wiki (scroll down a bit to the "Windows" section). They recommend putting the sqlite3.dll file in windows/system32, which I'm reluctant to do, personally. Anywhere on the PATH will do: I put it in ruby/bin, myself.

Mike Woodhouse
A: 

When you try updating InstantRails per Joe Schneider's suggestion, you may receive some HTTP 403 or 503 errors (which I did a couple days ago). Since InstantRails is quite old, it cannot update itself directly. Check this post and you will be up and running in minutes, I would not even bother installing ruby on Windwos - InstantRails is the way to go...

http://www.expressionlab.com/2009/1/17/upgrading-instantrails-to-rails-2-2-on-windows

eakkas
A: 

Hello,

At this time, the issue you had is already fixed.

I would recommend read this tutorial which explains all the steps to setup Ruby + SQLite3 using the newer Ruby Installers for Windows.

The only update for the instructions will be download latest RC1 from RubyForge as described in this news announcement

Hope that helps.

Luis Lavena