views:

154

answers:

2

When I attempt to load the Rails console (or load my website running Apache/Passenger), I get an error that it can't load a gem that I've already installed:

> script/console
Loading development environment (Rails 2.3.8)
no such file to load -- authlogic
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:164:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/nblade/vipreblade/src/console/config/environment.rb:11
/usr/lib/ruby/1.8/irb/init.rb:254:in `require'
/usr/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:252:in `each'
/usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
/usr/lib/ruby/1.8/irb.rb:54:in `start'
/usr/bin/irb:13
no such file to load -- machinist
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:164:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/nblade/vipreblade/src/console/config/environment.rb:11
/usr/lib/ruby/1.8/irb/init.rb:254:in `require'
/usr/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:252:in `each'
/usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
/usr/lib/ruby/1.8/irb.rb:54:in `start'
/usr/bin/irb:13
no such file to load -- authlogic
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:169:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/nblade/vipreblade/src/console/config/environment.rb:11
/usr/lib/ruby/1.8/irb/init.rb:254:in `require'
/usr/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:252:in `each'
/usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
/usr/lib/ruby/1.8/irb.rb:54:in `start'
/usr/bin/irb:13
no such file to load -- machinist
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:169:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/nblade/vipreblade/src/console/config/environment.rb:11
/usr/lib/ruby/1.8/irb/init.rb:254:in `require'
/usr/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:252:in `each'
/usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
/usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
/usr/lib/ruby/1.8/irb.rb:54:in `start'
/usr/bin/irb:13
Missing these required gems:
  authlogic  
  machinist  

You're running:
  ruby 1.8.7.249 at /usr/bin/ruby1.8
  rubygems 1.3.5 at /var/lib/gems/1.8

Run `rake gems:install` to install the missing gems.

So, I followed the instructions to install the gems as follows:

> sudo rake gems:install --trace
(in /home/nblade/vipreblade/src/console)
DEPRECATION WARNING: Rake tasks in vendor/plugins/delayed_job/tasks, vendor/plugins/easy-fckeditor/tasks, vendor/plugins/jrails/tasks, and vendor/plugins/restful_authentication/tasks are deprecated. Use lib/tasks instead. (called from /var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/rails.rb:10)
** Invoke gems:install (first_time)
** Invoke gems:base (first_time)
** Execute gems:base
** Invoke environment (first_time)
** Execute environment
** Execute gems:install

It didn't install anything, so I check my gem environment for good measure:

> gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://gemcutter.org", "http://gems.github.com"]
  - REMOTE SOURCES:
     - http://gemcutter.org
     - http://gems.github.com

> which gem
/usr/bin/gem

> ls -al /usr/bin/gem
lrwxrwxrwx 1 root root 21 2010-07-14 11:29 /usr/bin/gem -> /etc/alternatives/gem

> ls -al /etc/alternatives/gem
lrwxrwxrwx 1 root root 15 2010-07-14 11:29 /etc/alternatives/gem -> /usr/bin/gem1.8

> ls -al /usr/bin/gem1.8 
-rwxr-xr-x 1 root root 545 2009-10-09 17:51 /usr/bin/gem1.8

> echo $PATH
/var/lib/gems/1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

> echo $GEM_PATH
/var/lib/gems/1.8:

> which ruby
/usr/bin/ruby

> ls -al /usr/bin/ruby
lrwxrwxrwx 1 root root 7 2010-07-13 19:54 /usr/bin/ruby -> ruby1.8

> ls -al /usr/bin/ruby1.8
-rwxr-xr-x 1 root root 5488 2010-03-19 10:53 /usr/bin/ruby1.8

> /usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

I also verified that the gems ARE INSTALLED:

> ls -al /var/lib/gems/1.8/gems | grep authlogic
drwxr-xr-x  7 root root 4096 2010-08-03 12:14 authlogic-2.1.5

> ls -al /var/lib/gems/1.8/gems | grep machinist
drwxr-xr-x  4 root root 4096 2010-08-03 12:14 machinist-1.0.6

So, obviously I'm doing something wrong, but I'm not sure what else to check. Any suggestions?

Thanks.

+1  A: 

does "gem list | grep machinist" list anything? You may try running "gem uninstall machinist" and then "gem install machinist"

Jason Noble
Yes, gem list shows both missing gems. I tried to uninstall/reinstall, but that didn't help. After the reinstall here's what I have:> gem list | grep machinistmachinist (1.0.6)> gem list | grep authlogicauthlogic (2.1.5)
Chip Castle
+2  A: 

Found it. I had forgotten that I had previously unpacked the gems, so I looked under vendor/gems of my rails project, and sure enough, neither the authlogic nor the machinist gem directories had any code in them (although the directory did exist and contained a .specification file). So, to fix this I did this:

rake gems:unpack:dependencies
rake gems:build

To verify what I had done:

rake gems

Now script/console and Apache/Passenger work fine!

Chip Castle
Don't forget to accept your own answer
bjg
I tried to accept it, but it's telling me I have to wait a couple of days. Thanks for the heads up, tho.
Chip Castle