Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

no such file to load -- bundler (LoadError) in Rails 3.0.0.beta

#3990

I installed Rails 3.0.0.beta in both Ruby 1.9.1 and JRuby 1.4.0 following the instructions found here: http://weblog.rubyonrails.org/2010/2/5/rails-3-0-beta-release and after generating a new application with

rails rails3_blog -d mysql

all goes well, but when I try to start the server with

rails server

I get

/home/johnny/workspace/rails3_blog/config/boot.rb:6:in `require': no such file to load -- bundler (LoadError)
from /home/johnny/workspace/rails3_blog/config/boot.rb:6:in `rescue in <top (required)>'
from /home/johnny/workspace/rails3_blog/config/boot.rb:2:in `<top (required)>'
from /home/johnny/workspace/rails3_blog/script/rails:9:in `require'
from /home/johnny/workspace/rails3_blog/script/rails:9:in `<main>'

On JRuby I'm seeing the same error.

My environment is as follows:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic

$ cat /proc/version
Linux version 2.6.31-20-generic (buildd@yellow) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) ) [#57](/projects/8994/tickets/57 "Ticket #57")-Ubuntu SMP Mon Feb 8 09:02:26 UTC 2010

$ ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]

$ jruby -v
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [amd64-java]

Reported by Johnny · February 18th, 2010 @ 03:53 PM

State: invalid
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: none

Activity

  1. Marc Love
    Marc Love

    It could be that you have an old version of the bundler gem still installed on your system and it causes issues with the updated version operating correctly. Do the following:

    sudo gem uninstall bundler -a
    sudo gem install bundler
    

    Then try it again.

    February 18th, 2010 @ 11:00 PM

  2. Johnny
    Johnny

    @Marc, did as you suggested, but to no avail. I'm still seeing the same error.

    February 19th, 2010 @ 02:35 PM

  3. José Valim
    José Valim

    What gem list -d bundler returns? Something seems to be messed up in your load path. Opening up an irb console and doing 'require "bundler"' works?

    February 21st, 2010 @ 12:21 PM

  4. Johnny
    Johnny

    @Valim,

    Here it is:

    $ gem list -d bundler
    
    *** LOCAL GEMS ***
    
    bundler (0.9.7)
        Authors: Carl Lerche, Yehuda Katz
        Homepage: http://github.com/carlhuda/bundler
        Installed at: /usr/lib/ruby1.9.1/gems/1.9.1
    
        Bundles are fun
    
    $ irb
    irb(main):001:0> require "bundler"
    LoadError: no such file to load -- bundler
            from (irb):1:in `require'
        from (irb):1
            from /usr/local/bin/irb:12:in `<main>'
    

    February 22nd, 2010 @ 02:35 PM

  5. José Valim
    José Valim
    • State changed from new to invalid

    It cannot find bundler for some odd reason. Try reinstalling bundler, rails or a clean setup with RVM.
    I'm marking as invalid, feel free to open another ticket if I'm wrong.

    February 23rd, 2010 @ 09:13 PM

  6. Johnny
    Johnny

    If I enter a shell with the command:

    bundle exec batch
    

    then the error disappears and the server starts up.

    March 3rd, 2010 @ 05:32 PM

  7. Eric Koslow
    Eric Koslow

    I have this same error, and Ubuntu 9.10. I think it has to do with my PATH, but I'm not certain. I can run bundle from the command line, but "require 'bundler'" gives me the same error.

    March 4th, 2010 @ 05:54 AM

  8. Greg Moreno
    Greg Moreno

    I encountered the same problem with ruby 1.9.1p243 + ubuntu 9.10. Setting GEM_HOME fixes the problem.

    March 8th, 2010 @ 02:44 AM

  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from invalid to open
    • Assigned user set to Yehuda Katz (wycats)

    April 27th, 2010 @ 07:26 PM

  10. neocoin
    neocoin

    I encountered the same problem

    environment

    ubuntu 10.04
    ruby1.9.1p378
    

    executed commands:

    gem1.9.1 install --no-ri --no-rdoc rails --pre
    rails my
    cd my
    rails s
    
    /...ignore.../my/config/boot.rb:4:in `require': no such file to load -- bundler (LoadError)
        from /...ignore.../my/config/boot.rb:4:in `<top (required)>'
        from script/rails:8:in `require'
        from script/rails:8:in `<main>'
    

    May 2nd, 2010 @ 02:13 AM

  11. Arnaud Leymet
    Arnaud Leymet

    I got the same error on Ubuntu 10.04 desktop i386, while using Ruby1.9.1 with Rails 3-pre.
    And As Greg said, changing the GEM_HOME environment variable does the trick!
    I used the following command to fix this issue:

    export GEM_HOME=/usr/lib/ruby1.9.1/gems/1.9.1/
    

    May 6th, 2010 @ 04:46 PM

  12. avapoet
    avapoet

    @Arnaud:

    Same problem on Ubuntu 10.04 desktop i386, but I needed to run:

    export GEM_HOME=/usr/lib/ruby/gems/1.9.1/

    Pay attention and check what's right for you. The correct directory is the one which contains the gems directory which in turn contains all of your gems!

    May 17th, 2010 @ 12:26 PM

  13. Rohit Arondekar
    Rohit Arondekar

    I can't reproduce this on Ubuntu 10.04, seems to be a path problem. If you encounter this error do what avapoet has suggested and figure out where your gems are and set GEM_HOME to that path. I believe this ticket can be closed?

    May 23rd, 2010 @ 06:49 AM

  14. Ryan Bigg
    Ryan Bigg
    • State changed from open to invalid

    Must set the GEM_HOME environment variable. I think this is more of a bundler issue than a Rails issue (although it does occur during the use of Rails, it may occur elsewhere too)

    May 23rd, 2010 @ 06:53 AM

  15. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    And Rohit informs me it's a package manager issue, not a Bundler issue.

    If OP could provide detailed information on how he installed Ruby / Rails then we may be able to go about reproducing this and nail down the real culprit.

    May 23rd, 2010 @ 06:56 AM

  16. Will St. Clair
    Will St. Clair

    Upgrading an app to R3 and having this problem. Reinstalled bundler and set GEM_HOME to no avail. Mac OS X 10.6, ruby 1.8.7

    $ rails server
    script/rails:9:in `require': no such file to load -- rails/commands (LoadError)
        from script/rails:9
    
    $ irb
    >> require "bundler"
    => true
    >> quit
    
    $ echo $GEM_HOME
    /usr/lib/ruby/gems/1.8/gems/
    

    I tried bundle exec batch but it just hung so I killed it. Sigh.

    June 4th, 2010 @ 09:24 PM

  17. Will St. Clair
    Will St. Clair

    Disregard! sudo bundle install was bundling 2.3.8 instead of 3.0.0.beta3. Fixed it by specifying the version in my Gemfile.

    June 4th, 2010 @ 09:46 PM

  18. Jeremy Kemper
  19. Alex Pooley
    Alex Pooley

    fwiw... I had to set "RUBYOPT=rubygems" env variable to make bundler happy...

    uubuntu@ip-10-170-77-113:~$ bundle
    /var/lib/gems/1.8/gems/bundler-1.0.7/bin/bundle:4:in `require': no such file to load -- bundler (LoadError)
        from /var/lib/gems/1.8/gems/bundler-1.0.7/bin/bundle:4
    ubuntu@ip-10-170-77-113:~$ export RUBYOPT=rubygems
    ubuntu@ip-10-170-77-113:~$ bundle
    Could not locate Gemfile
    

    December 18th, 2010 @ 06:40 AM

  20. herval
    herval

    this might be a completely unrelated case, but... I've stumbled on this problem lately when running a rails app in my env (Snow Leopard + RVM + 1.9.2). I get the 'bundler not found' problem when starting with sudo (to use port 80), but NOT when running regularly

    $ script/rails server => Booting WEBrick => Rails 3.0.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2011-02-10 16:59:17] INFO WEBrick 1.3.1 [2011-02-10 16:59:17] INFO ruby 1.9.2 (2010-12-25) [x86_64-darwin10.6.0] [2011-02-10 16:59:17] INFO WEBrick::HTTPServer#start: pid=82986 port=3000

    versus....

    $ sudo script/rails server /Users/herval/Development/plim/config/boot.rb:9:in rescue in <top (required)>': uninitialized constant Object::Bundler (NameError)

    from /Users/herval/Development/plim/config/boot.rb:5:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from script/rails:5:in `<main>'
    

    Guess it's more of a problem related to RVM and some weird linkage to osx's system ruby? (I installed RVM on a user level)

    February 10th, 2011 @ 08:04 PM