Can't start script/console, but can start webrick

I have this app on other computers and it works fine. On my laptop I was
running instant rails, but have scrapped it.

My error is:

C:\data\0315_FitWitWeb>ruby script/console
Loading development environment (Rails 2.0.2)
C:/data/0315_FitWitWeb/config/environment.rb:11:in `require': no such
file to lo
ad -- active_merchant (LoadError)
        from C:/data/0315_FitWitWeb/config/environment.rb:11
        from c:/ruby/lib/ruby/1.8/irb/init.rb:252:in `require'
        from c:/ruby/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
        from c:/ruby/lib/ruby/1.8/irb/init.rb:250:in `each'
        from c:/ruby/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
        from c:/ruby/lib/ruby/1.8/irb/init.rb:21:in `setup'
        from c:/ruby/lib/ruby/1.8/irb.rb:54:in `start'
        from c:/ruby/bin/irb:13

my environment file is very simple:

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION

# get activemerchant going
require 'active_merchant'


I can start webrick fine and my application runs perfectly. Yes,
activemerchant is installed:

C:\data\0315_FitWitWeb>gem list --local

*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activemerchant (1.3.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
builder (2.1.2)
fxri (0.3.6)
fxruby (1.6.12)
hpricot (0.6)
log4r (1.0.5)
rails (2.0.2)
rake (0.7.3)
RedCloth (3.0.4)
rubigen (1.2.4)
ruby-debug-base (0.10.0)
ruby-debug-ide (0.1.10)
rubygems-update (1.1.1)
sources (0.0.1)
win32-api (1.0.4)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-process (0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.0)
windows-pr (0.7.2)

I am on windows, have stopped/started the computer several times. Any
help is greatly appreciated.



Put that line further down (ie after the initializer block or in a file in config/initializers_: you can't be sure rubygems has been loaded at that point. I'm guessing webrick requires ruby gems early on its startup process (mongrel certainly doesn, then again it is a gem) which saves your bacon when running script/server


Wow, that was a fast reply. Thanks. The perfect solution.