rails console doesn't start
Asked Answered
W

8

65

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..

Wolgast answered 18/6, 2014 at 2:8 Comment(2)
Have you updated your rails version recently? If so this answer may help you.Pushed
No I didnt.. Its start to happen when i tried to install 'gem debugger'Wolgast
L
234

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.

Lewiss answered 24/7, 2015 at 3:57 Comment(6)
this one work for me too, I was trying to run rails runner, and it just return immediately without output or run anything, and then I try rails console, same thing happen, but rails s work. and I try this spring stop then rails console work again!Durr
there is an answer below that suggests commenting out spring. That did not help. Even commeted out, I had to spring stopto get the console working.Breckenridge
2.5 years down the road, this answer helped me after a day of trawlling thru google. @on_a_railsroad.Mair
It's July 2018 and this answer is still useful! I'm on Ruby 5.0.7 and Spring 2.0.2.Desuetude
Gosh this was driving me nuts. Thanks for the answerKunlun
This answer just patched the issue, but I don't know how to avoid that it occurs again? Some one knows why happen this problem with spring. In my case occurs each time that I run rails runner or rails console.Wooldridge
A
11

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.

Akeyla answered 18/6, 2014 at 2:20 Comment(0)
P
9

Running spring stop did the trick for me.

Peddler answered 23/12, 2020 at 23:21 Comment(0)
M
4

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

Margo answered 17/5, 2022 at 6:56 Comment(0)
C
2

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

Catie answered 17/10, 2016 at 8:16 Comment(0)
U
2

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.

Unquote answered 6/10, 2018 at 17:28 Comment(0)
D
1

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.

Debrahdebrecen answered 3/4, 2016 at 12:16 Comment(0)
W
1

I had the same issue with rails console not starting but spring stop didn't work for me as spring was not running. I found that I needed to restart rails.

rails restart
Winger answered 18/4, 2024 at 13:58 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.