1

I'm new to Ruby on Rails and was following Lynda's Ruby on Rails essential training guide videos.

In the getting started set of videos, we are shown how the 'rails generator' command works. I have followed all the steps, but every time I type in '$ rails generate' I get the following error:

Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
    from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/commands.rb:33:in `<module:Spring>'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/commands.rb:4:in `<top (required)>'
    from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:77:in `preload'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

How do you suppose I get around this?

iheartkode
  • 57
  • 6
user3794832
  • 117
  • 1
  • 1
  • 12

3 Answers3

5

The answer is in the Error:

You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all`

Update with this:

gem install rubygems-update

Then run:

gem pristine --all

All should be well.

Warren P
  • 65,725
  • 40
  • 181
  • 316
iheartkode
  • 57
  • 6
  • It gets me past that error but gives me another one: – user3794832 Jul 01 '14 at 23:33
  • Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance. bin/rails:6: warning: already initialized constant APP_PATH /Users/waleedrahamtullah/Sites/simple_cms/bin/rails:6: warning: previous definition of APP_PATH was here Usage: rails COMMAND [ARGS] The most common rails commands are: generate Generate new code (short-cut alias: "g") console Start the Rails console (short-cut alias: "c") – user3794832 Jul 01 '14 at 23:34
0

When I update

gem install rubygems-update

and then

 gem pristine --all

it didn't work for me.

But answer from How to upgrade rubygems helped to fix issue, but after that for some reason I had to install rails again and install all gems.

Install rubygems-update

gem install rubygems-update
update_rubygems
gem update --system

run this commands as root or use sudo.

Community
  • 1
  • 1
Daniil Grankin
  • 3,841
  • 2
  • 29
  • 39
0

I am using ruby with rbenv so I could run those as normal user. However, generating new rails site

rails new blog

Shows warning about old rubygems.

    Warning: You're using Rubygems 2.0.14 with Spring.

Hmm. Checking the environment:

    gem env

shows

    RubyGems Environment:
      - RUBYGEMS VERSION: 2.0.14

which is no good. As suggested on the internets I run:

gem install rubygems-update
gem pristine --all
update_rubygems

I am not sure if gem pristine --all was needed, but it can't harm anything. Checking the update status now

    gem env

shows

    RubyGems Environment:
      - RUBYGEMS VERSION: 2.4.6

which is good. Calling

rails new blog

and everything went ok. No warning at all.

andrej
  • 4,518
  • 2
  • 39
  • 39