Neigaard
Neigaard

Reputation: 4074

My rails project fails after upgrading to ruby 1.9.2 on OS X

I have upgaded ruby to 1.9.2, rubygems 1.5.0 and installed the latest rails 3.0.3 by following this tutorial:

http://hivelogic.com/articles/ruby-rails-mongrel-mysql-osx

But now my existing project no longer works. If I do a "ruby script/about", I get this:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- /Users/sneigaard/work/rails/myproject/config/../vendor/rails/railties/lib/initializer (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:45:in `load_initializer'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:38:in `run'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:11:in `boot!'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:110:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from script/about:2:in `<main>'

If I run "mongrel_rails start" I get this error:

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require': no such file to load -- /Users/sneigaard/work/rails/myproject/config/../vendor/rails/railties/lib/initializer (LoadError)
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:45:in `load_initializer'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:38:in `run'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:11:in `boot!'
    from /Users/sneigaard/work/rails/myproject/config/boot.rb:110
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from /Users/sneigaard/work/rails/myproject/config/environment.rb:7
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
    from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    from /usr/bin/mongrel_rails:19:in `load'
    from /usr/bin/mongrel_rails:19

In script/server I have this:

#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server'

I have searched and searched the net, but I can not figure this out, and my project is stuck :( Please help me.

Thank you
Søren

Upvotes: 0

Views: 1607

Answers (3)

simianarmy
simianarmy

Reputation: 1507

I had this problem when upgrading an app from 1.8.7 to 1.9.2.
In Ruby 1.9.2, Kernel.require doesn't work like 1.8, instead it seems they want you to use Kernel.require_relative

See here for solutions that will work in both rubies

Ruby: require vs require_relative - best practice to workaround running in both Ruby <1.9.2 and >=1.9.2

Upvotes: 0

andrea
andrea

Reputation: 3505

some misconfiguration with your ruby , if you type

which ruby
gem environment

and

ruby -v

it's all coerent?

I will suggest to use RVM very very simple to setup good documentation and usefull for your buisness.

also seems that your project is still in rails 2.3.* not 3.0.* , in rails 3 thear is not a script/server script file. install rvm ruby 1.9.2 and the right gem to your project.

hope this could help.

Upvotes: 1

pjammer
pjammer

Reputation: 9577

it's rails server does that spit out the same error? you appear to be using rails 2 commands in rails 3. also, are all your gems loaded into 1.9.2? you have to reload everything when switching rubies.

Upvotes: 1

Related Questions