1

When I try to run rails console the following error comes up

/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire': cannot load such file -- bundler/setup (LoadError) `

But I have bundler installer , bundler -v gives Bundler version 1.11.2 My ruby version is ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

This is my ruby environment

 RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.2.1 (2015-02-26 patchlevel 85) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/ubuntu/.rvm/gems/ruby-2.2.1
  - RUBY EXECUTABLE: /home/ubuntu/.rvm/rubies/ruby-2.2.1/bin/ruby
  - EXECUTABLE DIRECTORY: /home/ubuntu/.rvm/gems/ruby-2.2.1/bin
  - SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/ubuntu/.rvm/gems/ruby-2.2.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/ubuntu/.rvm/gems/ruby-2.2.1/bin
     - /home/ubuntu/.rvm/gems/ruby-2.2.1@global/bin
     - /home/ubuntu/.rvm/rubies/ruby-2.2.1/bin
     - /home/ubuntu/.rvm/bin
     - /home/ubuntu/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

I don't know how to fix this issue.

Navin
  • 636
  • 8
  • 19
  • Possible duplicate of [cannot load such file -- bundler/setup (LoadError)](http://stackoverflow.com/questions/19061774/cannot-load-such-file-bundler-setup-loaderror) – Radix Dec 22 '15 at 05:51
  • Did you try `bundle install`? Did you try `bundle exec rails c` ? – nathanvda Dec 22 '15 at 08:14

2 Answers2

1

It seems that your machine is using System Ruby

In order to use ruby installed by RVM

1: close all Terminal and open a new one.

2: rvm list rubies

It would show you list of ruby version which is installed in your machine

   ruby-1.8.7-p374 [ i686 ]
   ruby-1.9.3-p448 [ i686 ]
=> ruby-1.9.3-p547 [ i686 ] # this version in my case
   ruby-2.1.1 [ i686 ]

3: rvm use <ruby-version> # rvm use ruby-2.1.1

Hope this help you !!!

Gupta
  • 8,882
  • 4
  • 49
  • 59
0

Do you actually have rails installed on this RVM gemset? If not, you'll have to do gem install rails first.