Rails error: `rescue in ': uninitialized

2019-05-23 03:15发布

问题:

Earlier today I updated gems on my system with:

gem update

It updated few gems but after that I can't start my rails server, I get this error:

/Users/gugguson/rubys/my_rails_app/config/boot.rb:9:in `rescue in <top (required)>': uninitialized constant Bundler (NameError)
    from /Users/gugguson/rubys/my_rails_app/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>'

If I create a new app with:

rails new test99

... and then go into the folder and run rails server s I get this error:

[~/rubys/test99] rails s
<internal:gem_prelude>:168:in `load_full_rubygems_library': undefined local variable or method `path' for Gem::QuickLoader:Module (NameError)
    from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler/rubygems_ext.rb:5:in `<top (required)>'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler.rb:11:in `<top (required)>'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler/setup.rb:4:in `<top (required)>'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `rescue in require'
    from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /Users/gugguson/rubys/test99/config/boot.rb:6: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>'

Any ideas?

Thanks, Johann

回答1:

As lebreeze said, try updating rubygems with gem update --system. Looks like there were some issues and that they were fixed in recent versions.