本文介绍了加载时Ruby on Rails控制台挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于任何原因,Ruby on Rails控制台都拒绝启动;它只是挂了。我没有对代码进行任何更改,使用相同版本的Ruby和Ruby on Rails的其他项目也没有问题。当我最后 + 时,我得到了这个堆栈跟踪,它指向Sp​​ring。

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 + I get this stack trace, which points to Spring.

我不能解释为什么这种情况在一瞬间到下一瞬间都可以正常工作。我已经通过RVM清除了所有的gem,并通过bundle命令重新安装了所有gem,但是还是没有运气。

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.

据我所知,Ruby on Rails服务器也没有问题。问题与项目有关,但是代码没有更改,只有Ruby on Rails控制台出现问题。

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

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$


推荐答案

重启Spring应该修复挂起的命令:

Restarting Spring should fix the hanging commands:

$ bin/spring stop

我遇到了挂起命令(耙子,垃圾桶/铁轨等)删除并重新创建新的Ruby on Rails应用程序之后。 Google没那么有用。希望是这样。

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会自动启动。

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

这篇关于加载时Ruby on Rails控制台挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:30