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
Restarting Spring should fix the hanging commands:
$ bin/spring stop
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 will start automatically when you re-run your command.
If $ bin/spring stop
doesn't solve the issue, then check to make sure there isn't an orphaned Spring process still hanging around:
$ ps aux | grep -i spring
If you see something like
user 7163 0.0 0.0 110356 2165 pts/3 S+ 19:40 0:00 grep --color=auto -i spring
user 16980 0.0 0.4 398826 17580 ? Sl Aug31 0:00 spring server | current | started 277 hours ago
then kill the errant spring process and try to start the console again:
$ kill -9 16980
$ rails c
When it is suspected that Spring is the cause of weirdness, try to run this command:
spring stop && spring start
Changing the following method in the lib/application.rb file of the spring gem (path can be shown with the gem info spring command) like this does the trick:
def eager_preload
with_pty do
# we can't see stderr and there could be issues when it's overflown
# see https://github.com/rails/spring/issues/396
STDERR.reopen("/dev/null")
preload
end
end
see https://github.com/markiz/spring/commit/5f3ab734fc45d541aaaccb05b59cd95aa49fe8ef
It's something wrong with the Spring gem version I guess.
Go to your Gemfile and comment gem 'spring'. Then run bundle install
and try again.
# gem 'spring'
And then:
bundle install
If your work depends on the gem, try update the gems by:
bundle update