user3055120
user3055120

Reputation: 65

Gem::LoadError when running Rails console

I am trying to run Rails Console by executing rails console and i am getting that error

 /home/ahmed/.rvm/gems/ruby-.2.0@global/gems/bundler-.8.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
  from home/ahmed/.rvm/gems/ruby-.2.0@global/gems/bundler-.8.2/lib/bundler/runtime.rb:19:in `setup'
  from /home/ahmed/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.2/lib/bundler.rb:122:in `setup'
  from /home/ahmed/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.2/lib/bundler/setup.rb:8:in `<top (required)>'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/ahmed/.rvm/gems/ruby-2.2.0/gems/spring-1.3.3/lib/spring/commands.rb:33:in `<module:Spring>'
  from /home/ahmed/.rvm/gems/ruby-2.2.0/gems/spring-1.3.3/lib/spring/commands.rb:4:in `<top (required)>'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/ahmed/.rvm/gems/ruby-2.2.0/gems/spring-1.3.3/lib/spring/server.rb:9:in `<top (required)>'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
  from /home/ahmed/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'

Upvotes: 4

Views: 2089

Answers (5)

Reyza Permana
Reyza Permana

Reputation: 31

change in your application Gemfile

gem 'spring'

to

gem 'spring', "~>1.3.3"

and

bundle install
bundle update

it work for me!

Upvotes: 3

Prashant Raghav
Prashant Raghav

Reputation: 41

change in your application Gemfile

gem 'spring'

to

gem 'spring', "~>1.3.3" 

Upvotes: 2

TABISH KHAN
TABISH KHAN

Reputation: 1623

try running bundle update first - that fixed this issue for me

   bundle update

then

  rails console

Upvotes: 1

geekdev
geekdev

Reputation: 1212

I think your machine has multiple spring gem version. I would like to remove spring 1.3.3.

$ gem uninstall spring

It shows all spring gems on your machine

uninstall spring version like shown on this attached image

I had similar issue, it solved the issue

Upvotes: 13

basiam
basiam

Reputation: 1567

did you try prepending bundle exec to your command as it suggest?

bundle exec rails console

Upvotes: 0

Related Questions