不管出于什么原因,RubyonRails 控制台拒绝启动; 它只是挂起。我没有对我的代码做任何修改,其他使用相同版本的 Ruby 和 Ruby on Rails 的项目也没有问题。当我最终得到 Ctrl + C时,我得到了这个栈跟踪,它指向 Spring。
我无法解释为什么这种情况会一直发生,而且一直都很正常。我已经通过 RVM 清除了所有 gem,并通过 bundle 命令重新安装了所有 gem,但仍然没有找到。任何想法都可以。
而且据我所知,RubyonRails 服务器也没有任何问题。这个问题与项目有关,但是没有代码发生变化,只有 Ruby on Rails 控制台有这个问题。
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$