Rails 3 Problem: no such file to load -- rails (LoadError)

I just ran the gem bundle on the third_rails demo app, but for some
reason rails can't be loaded!?

kristian-mandrups-macbook-pro:third_rails kristianconsult$ rails -v
Rails 3.0.pre

kristian-mandrups-macbook-pro:third_rails kristianconsult$ script/
generate model Post name:string
/Users/kristianconsult/my_rails/rails3_apps/third_rails/config/boot.rb:
71:in `require': no such file to load -- rails (LoadError)
  from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/
boot.rb:71:in `load_initializer'
  from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/
boot.rb:44:in `run'
  from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/
boot.rb:16:in `boot!'
  from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/
boot.rb:148
  from script/generate:2:in `require'
  from script/generate:2
kristian-mandrups-macbook-pro:third_rails kristianconsult$ script/
console
/Users/kristianconsult/my_rails/rails3_apps/third_rails/config/boot.rb:
71:in `require': no such file to load -- rails (LoadError)
...

Anyone?

You need to bundle your rails into the Rails 3 app. Did you do that?

Also make sure that if you use multiple versions of Ruby, you will
need either to re-bundle your gems under the one you decided to use
after switching, or to add a symlink in vendor/gems/ruby.

Hope it solves the problem.

Aleksey

I just ran the gem bundle on the third_rails demo app, but for some

reason rails can’t be loaded!?

kristian-mandrups-macbook-pro:third_rails kristianconsult$ rails -v

Rails 3.0.pre

kristian-mandrups-macbook-pro:third_rails kristianconsult$ script/

generate model Post name:string

/Users/kristianconsult/my_rails/rails3_apps/third_rails/config/boot.rb:

71:in `require’: no such file to load – rails (LoadError)

    from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/

boot.rb:71:in `load_initializer’

    from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/

boot.rb:44:in `run’

    from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/

boot.rb:16:in `boot!’

    from /Users/kristianconsult/my_rails/rails3_apps/third_rails/config/

boot.rb:148

    from script/generate:2:in `require'

    from script/generate:2

kristian-mandrups-macbook-pro:third_rails kristianconsult$ script/

console

/Users/kristianconsult/my_rails/rails3_apps/third_rails/config/boot.rb:

71:in `require’: no such file to load – rails (LoadError)

Anyone?

If you’ew using Rails 3.0.pre, then I would recommend doing the following:

  1. follow the instructions here first

http://weblog.rubyonrails.org/2010/1/1/getting-a-new-app-running-on-edge

a) see if similar ticket exists here

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview

b) if (a) exists, then add your comments to that ticket. Otherwise, please file another ticket providing the following:

  • ruby version (i.e. ruby -v)

  • OS version

  • the exact steps to recreate the issue in a understandable stepwise format

Lastly, I would recommend the above steps for all people interested using Rails 3.0.pre because these types of issues

need to be made aware to the Rails core team.

Good luck,

-Conrad