简体   繁体   中英

rails console doesn't start

I`m in root of my application, and when I type

$ rails console

It looks like something is loading, but nothing happens.

And when I stop ^C I received this trace:

^C/home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `gets': Interrupt
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `verify_server_version'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/run.rb:25:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /home/jonatas/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/jonatas/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/jonatas/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/jonatas/Code/Ruby/jonatasteixeira/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

I have no idea whats going on..

I may be answering a bit late for this, but for the sake of the others who are looking for the answer... it's here

Basically, enter this command

spring stop

The issue , as far as I understand, is with the spring gem, specifically, it checks the server for versions, which doesn't tally up.

For my case, the problem started when when I add some new gems into the gemfile.

So once you stop spring and type in any other rails command, spring restart, and every thing should work again, at least until the same problem occurs, or the dev patched the issue.

I've not seen this before, but it looks like maybe spring is messed up in your setup for some reason? Try going into your Gemfile and look for the line that calls gem 'spring' and comment that out. Then run bundle install and try again.

This isn't a proper solution, but if it gets your rails console working again tonight then hopefully it will help you out until a proper solution is discovered.

运行spring stop对我有用。

In my case, the same trouble is occured on my production environment.

If your environmet is also production, in the first place, you must not install spring on your production environment.

refer this https://github.com/rails/spring/issues/318 https://github.com/rails/spring/pull/337/files

It can be resolved by this command on your production

RAILS_ENV=production bundle install --clean --without development test

I could run rails console again in Rails 5.2.1 with:

  • bundle clean --force
  • bundle install --without development test

Note: My RAILS_ENV variable is already set to production .

I had the same problem in the production environment. The spring gem was not in the development group in the Gemfile. After I correct this all worked fine.

对我来说, spring gem 导致这个问题运行spring stop解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM