0

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

Neigaard
  • 3,726
  • 9
  • 49
  • 85
  • Do you really need 1.9.2? I do work with Rails 3 and have Ruby Enterprise Edition set up with rvm (which I strongly recommend) – apneadiving Feb 05 '11 at 13:43

3 Answers3

1

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.

pjammer
  • 9,489
  • 5
  • 46
  • 56
  • rails server gives me a list of options like for creating a new rails app. When you say reload everything then how would I do that? – Neigaard Feb 05 '11 at 18:44
  • Oh I see that "rails server" launches webrick, well it does nothing on my setup and never has, but I used to run webrick like this "ruby script/server webrick", and yes it gives me the same error. – Neigaard Feb 05 '11 at 19:08
  • Your ruby is still 1.8.x. Use RVM, then install ruby 1.9.2, then install ALL of your gems again, or run `bundle` after you upgrade to 1.9.2 properly. when you run `rails server` then it will work. – pjammer Feb 05 '11 at 21:30
  • I have rvm installed now, but how do install all of my gems again? – Neigaard Feb 06 '11 at 12:49
  • if you are using rails 3, all of your gems are in the Gemfile in the RailsRoot folder, so /your/path/to/appname . to install all of the gems that your app will use just open a console and type `bundle` . If you are on a rails 2.3.x project, go to Rails root and type `rake gems:install` into console. – pjammer Feb 06 '11 at 12:57
1

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.

andrea
  • 3,515
  • 2
  • 22
  • 14
  • which ruby /usr/local/bin/ruby – Neigaard Feb 05 '11 at 18:22
  • gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.9.2 (2010-12-25 patchlevel 136) [x86_64-darwin10.6.0] - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: /usr/local/bin/ruby - EXECUTABLE DIRECTORY: /usr/local/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-10 - GEM PATHS: - /usr/local/lib/ruby/gems/1.9.1 - /Users/sneigaard/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 – Neigaard Feb 05 '11 at 18:25
  • ruby -v ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0] – Neigaard Feb 05 '11 at 18:26
  • Hm that was some messy comments.. Hope you guys can make sense of them – Neigaard Feb 05 '11 at 18:35
0

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

Community
  • 1
  • 1
simianarmy
  • 1,485
  • 10
  • 13