Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring stopping Rails console from running

I recently upgraded my Ruby to 2.5.0. Since then, I haven't been able to run the Rails Console properly. It either hangs indefinitely, or, after a few seconds, shows me this error:

before_session hook failed: NoMethodError: undefined method `reject!' for nil:NilClass

Full error:

Running via Spring preloader in process 6102
Loading development environment (Rails 5.1.4)
before_session hook failed: NoMethodError: undefined method `reject!' for nil:NilClass
Traceback (most recent call last):
/Users/zoro/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)

If I DISABLE_SPRING, I'm able to start up my console as expected. However, (Not sure if this is related, if it's not- I can figure this out separately) if any errors occur, the console "crashes" and kicks me back to the terminal:

⇒rails console
Loading development environment (Rails 5.1.4)
[1] pry(main)> a
Traceback (most recent call last):
bin/rails: undefined method `[]' for nil:NilClass (NoMethodError)
⇒

Any help on this would be greatly appreciated. Using rbenv to manage Rubies, and not having this error on other versions of Ruby.

like image 903
Rockster160 Avatar asked Jan 06 '18 01:01

Rockster160


1 Answers

This appears to be some strange issue with the binding_of_caller in conjunction with Spring. Removing that gem got things back working as expected. I knew I'd find the answer as soon as I asked.

There isn't currently a fix, but it does seem to have an open issue already: https://github.com/charliesome/better_errors/issues/411

like image 108
Rockster160 Avatar answered Nov 13 '22 08:11

Rockster160