我使用bundle update
来更新gemfile的开发支持和测试gem,因为所有的生产gem都是版本锁定的。更新后,nio4r保持在2.5.2,因为它已被锁定。然而,更新后,nio4r失败,并显示消息:nio4r-2.5.2/lib/nio/selector.rb:17:in 'initialize': unsupported backend: (ArgumentError)
堆栈跟踪如下:(注意,这是一个升级Ruby和Rails的努力,从获得正确的测试和重构基础开始。
Puma starting in single mode...
* Puma version: 6.3.0 (ruby 2.7.2-p137) ("Mugi No Toki Itaru")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 11436
* Listening on http://[::1]:3001
* Listening on http://127.0.0.1:3001
Exiting
Traceback (most recent call last):
20: from bin/rails:4:in `<main>'
19: from bin/rails:4:in `require'
18: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/commands.rb:18:in `<top (required)>'
17: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/command.rb:46:in `invoke'
16: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/command/base.rb:69:in `perform'
15: from ruby/2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
14: from ruby/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
13: from ruby/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
12: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:142:in `perform'
11: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:142:in `tap'
10: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:147:in `block in perform'
9: from ruby/2.7.0/gems/railties-5.2.5/lib/rails/commands/server/server_command.rb:53:in `start'
8: from ruby/2.7.0/gems/rack-2.2.7/lib/rack/server.rb:327:in `start'
7: from ruby/2.7.0/gems/puma-6.3.0/lib/rack/handler/puma.rb:76:in `run'
6: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/launcher.rb:194:in `run'
5: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/single.rb:53:in `run'
4: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/server.rb:248:in `run'
3: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/server.rb:248:in `new'
2: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/reactor.rb:28:in `initialize'
1: from ruby/2.7.0/gems/puma-6.3.0/lib/puma/reactor.rb:28:in `new'
ruby/2.7.0/gems/nio4r-2.5.2/lib/nio/selector.rb:17:in `initialize': unsupported backend: (ArgumentError)
1条答案
按热度按时间k0pti3hp1#
通过堆栈跟踪,我发现Puma::Server.run方法没有启动:rubyReact器。研究Puma,我发现它的版本只锁定到'~> 6'。它已经从6.0.0升级到6.3.0。查看更改日志,我发现在Puma Change History中,最大的更改是#2522。
这发生在5.2.0中,但影响显示在从6.0.0到6.3.0的过渡中。
解决方案是使用'~> 2'升级nio 4 r。我的是2.5.9,一切都很好。
注:变更#2522,如上所述,参考NIL:Selector source code。该源代码显示,在失败的语句17中,后端从早期的
[:ruby]
扩展为[:ruby, nil]
。实际上,零是被选择的值。