加载时Ruby on Rails控制台被挂起怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (18)

rails控制台拒绝启动,它只是挂起。我没有对我的代码进行任何更改,而使用相同版本的ruby和rails的其他项目没有问题。当我终于按Ctrl + C我得到这个堆栈跟踪,这指向spring。

我无法解释为什么这是从一个时刻到另一个时刻,在哪里工作正常。我已经通过RVM清除了所有的gem,并通过捆绑命令重新安装了所有gem。

另外,rails服务器没有问题,据我所知,问题是项目相关的,但没有代码已经改变,并且它唯一的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$ 
提问于
用户回答回答于
用户回答回答于

我猜这是spring的gem版本有问题。

去你的Gemfile并gem'spring'。然后运行软件包安装并重试。

# gem 'spring'

然后:

bundle install 

如果工作取决于gem,请尝试通过以下方式更新gem:

bundle update

扫码关注云+社区