spring/application.rb:161 未定义的方法“拒绝!”对于 nil:NilClass (NoMethodError)

spring/application.rb:161 undefined method `reject!' for nil:NilClass (NoMethodError)

我正在为我的应用程序使用 ruby 2.5 和 rails 5.0.1。当我尝试 运行 控制台或生成控制器或迁移时,它给我这个错误:

Running via Spring preloader in process 6473 Loading development environment (Rails 5.0.1) Traceback (most recent call last): /home/abwahed/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.0.1/lib/spring/application.rb:161:infork': 未定义方法 reject!' for nil:NilClass (NoMethodError)

几天前 here in spring gems repo. The underlying ruby gem binding_of_caller was creating the issue with ruby 2.5.0. The issue is marked as closed with a pr now here in binding_of_caller_repo 就这个问题进行了积极的讨论。所以,我认为您可以简单地执行 bundle updatebundle update binding_of_caller 来修复它。如果不起作用,您也可以尝试将 ruby 降级为 2.4.3。希望这有帮助。