小编典典

Ruby on Rails 控制台在加载时挂起

all

无论出于何种原因,Ruby on Rails 控制台都拒绝启动;它只是挂起。我没有对我的代码进行任何更改,使用相同版本的 Ruby 和 Ruby on
Rails 的其他项目也没有问题。当我终于Ctrl+C我得到这个堆栈跟踪,它指向 Spring。

我无法解释为什么这会从一个时刻发生到下一个,它工作正常。我已经通过 RVM 清除了所有的 gem,并通过 bundle
命令重新安装,但仍然没有运气。任何想法,将不胜感激。

据我所知,Ruby on Rails 服务器也没有问题。该问题与项目相关,但没有更改任何代码,只有 Ruby on Rails 控制台存在问题。

红宝石 2.1.2
轨道 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$

阅读 64

收藏
2022-08-24

共1个答案

小编典典

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

$ bin/spring stop

在删除并重新创建新的 Ruby on Rails 应用程序后,我遇到了挂起命令(rake、bin/rails 等)。谷歌没有那么有帮助。我希望这是。

当您重新运行命令时,Spring 将自动启动。

2022-08-24