rails console doesn't start

Ruby on-RailsRuby on-Rails-4Rails Console

Ruby on-Rails Problem Overview


I`m in root of my application, and when I type

$ rails console

It looks like something is loading, but nothing happens.

And when I stop ^C I received this trace:

^C/home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `gets': Interrupt
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `verify_server_version'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:25:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/jonatas/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/jonatas/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/jonatas/Code/Ruby/jonatasteixeira/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

I have no idea whats going on..

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

I may be answering a bit late for this, but for the sake of the others who are looking for the answer... it's here

Basically, enter this command

spring stop

The issue , as far as I understand, is with the spring gem, specifically, it checks the server for versions, which doesn't tally up.

For my case, the problem started when when I add some new gems into the gemfile.

So once you stop spring and type in any other rails command, spring restart, and every thing should work again, at least until the same problem occurs, or the dev patched the issue.

Solution 2 - Ruby on-Rails

I've not seen this before, but it looks like maybe spring is messed up in your setup for some reason? Try going into your Gemfile and look for the line that calls gem 'spring' and comment that out. Then run bundle install and try again.

This isn't a proper solution, but if it gets your rails console working again tonight then hopefully it will help you out until a proper solution is discovered.

Solution 3 - Ruby on-Rails

Running spring stop did the trick for me.

Solution 4 - Ruby on-Rails

In my case, the same trouble is occured on my production environment.

If your environmet is also production, in the first place, you must not install spring on your production environment.

refer this https://github.com/rails/spring/issues/318 https://github.com/rails/spring/pull/337/files

It can be resolved by this command on your production

RAILS_ENV=production bundle install --clean --without development test

Solution 5 - Ruby on-Rails

I could run rails console again in Rails 5.2.1 with:

  • bundle clean --force
  • bundle install --without development test

Note: My RAILS_ENV variable is already set to production.

Solution 6 - Ruby on-Rails

I had the same problem in the production environment. The spring gem was not in the development group in the Gemfile. After I correct this all worked fine.

Solution 7 - Ruby on-Rails

For me spring gem was causing this issue running spring stop resolved this.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonatasTeixeiraView Question on Stackoverflow
Solution 1 - Ruby on-RailsOn a RailsroadView Answer on Stackoverflow
Solution 2 - Ruby on-RailsbratscheView Answer on Stackoverflow
Solution 3 - Ruby on-Railsdavidauza.engineerView Answer on Stackoverflow
Solution 4 - Ruby on-RailskazuwombatView Answer on Stackoverflow
Solution 5 - Ruby on-RailsIs MaView Answer on Stackoverflow
Solution 6 - Ruby on-RailsMatthiasView Answer on Stackoverflow
Solution 7 - Ruby on-RailsMuhammad Ur RehmanView Answer on Stackoverflow