Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails console is hanging when loading

For whatever reason, the Ruby on Rails console refuses to start; it just hangs. I haven't made any changes to my code, and other projects using the same version of Ruby and Ruby on Rails have no issue. When I finally Ctrl + C I get this stack trace, which points to Spring.

I can't explain why this is happening from one moment to the next, where it was working fine. I have cleared out all the gems through RVM and reinstalled all through bundle command, but still no luck. Any ideas would be appreciated.

Also the Ruby on Rails server has no issue so as far as I can tell. The issue is project related, however no code has changed, and it's only the Ruby on Rails console that has the issue.

Ruby 2.1.2
Rails 4.1.4

user_a@ubuntu:~/work/app_a$ rails console
^C/home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `gets': Interrupt
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `verify_server_version'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:25:in `call'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in `call'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
    from /home/user_a/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/user_a/work/app_a/bin/spring:16:in `require'
    from /home/user_a/work/app_a/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

user_a@ubuntu:~/work/app_a$
like image 949
theog Avatar asked Oct 11 '22 02:10

theog


1 Answers

Restarting Spring should fix the hanging commands:

$ bin/spring stop

I experienced hanging commands (rake, bin/rails, etc.) after deleting and recreating a new Ruby on Rails application. Google wasn't that helpful. I hope this is.

Spring will start automatically when you re-run your command.

like image 477
cee-dub Avatar answered Oct 12 '22 14:10

cee-dub