Ruby on rails 无法通过WSL使用Rails启动本地服务器

Ruby on rails 无法通过WSL使用Rails启动本地服务器,ruby-on-rails,server,windows-subsystem-for-linux,puma,Ruby On Rails,Server,Windows Subsystem For Linux,Puma,我试着更新我的Rails应用程序,我相信这就是问题所在,因为我无法启动服务器。我已经尝试过切换Ruby版本并降级Rails,但在某个地方我遇到了麻烦,并且一直遇到同样的错误 .rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:233:'setsockopt'中:无效参数-setsockopt(2)(错误号::EINVAL) 我相信问题来了:日志的最后一行显示了彪马的问题 在 rails =>引导美洲狮 =>Rails 6.0.2.1应用

我试着更新我的Rails应用程序,我相信这就是问题所在,因为我无法启动服务器。我已经尝试过切换Ruby版本并降级Rails,但在某个地方我遇到了麻烦,并且一直遇到同样的错误

.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:233:'setsockopt'中:无效参数-setsockopt(2)(错误号::EINVAL)

我相信问题来了:日志的最后一行显示了彪马的问题

rails
=>引导美洲狮
=>Rails 6.0.2.1应用程序开始开发
=>运行“rails服务器--help”以获取更多启动选项
Puma在单一模式下启动。。。
*版本4.3.1(ruby 2.6.3-p62),代号:神秘旅行者
*最小线程数:5,最大线程数:5
*环境:发展
退出
回溯(最近一次呼叫最后一次):
31:从箱子/轨道:4:in`'
30:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active\u support/dependencies.rb:325:in“require”
29:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active\u support/dependencies.rb:291:in'load\u dependencity'
28:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active\u support/dependencies.rb:325:in'block in require'
27:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load\u path\u cache/core\u ext/kernel\u require.rb:30:in'require'
26:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load\u path\u cache/core\u ext/kernel\u require.rb:21:in“require\u with\u bootsnap\u lfi”
25:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load\u path\u cache/loaded\u features\u index.rb:92:in'register'
24:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load\u path\u cache/core\u ext/kernel\u require.rb:22:in`block in require_with_bootsnap\u lfi'
23:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load\u path\u cache/core\u ext/kernel\u require.rb:22:in'require'
22:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in`'
21:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/command.rb:46:in“invoke”
20:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in'perform'
19:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor.rb:387:in'dispatch'
18:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in“invoke_命令”
17:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/command.rb:27:in'run'
16:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in“perform”
15:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in'tap'
14:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:147:in'block in perform'
13:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:39:in'start'
12:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/rack-2.0.8/lib/rack/server.rb:297:in'start'
11:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/rack/handler/puma.rb:73:in'run'
10:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/launcher.rb:172:in'run'
9:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/single.rb:98:in'run'
8:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/runner.rb:161:in'load_and_bind'
7:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:90:in'parse'
6:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:90:in'each'
5:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:106:in`block in parse'
4:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:222:in'add_tcp_listener'
3:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:222:in'each'
2:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:223:in`block in add\u tcp\u listener'
1:from/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:233:in'add_tcp_listener'
/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb:233:'setsockopt'中:无效参数-setsockopt(2)(错误号::EINVAL)

提前谢谢你的帮助!丹尼找到了暂时的解决办法。 示例如下: 在文件
/home/%username%/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb
中或在您的情况下
/home/chocolope/.rvm/gems/ruby-2.6.3/gems/puma-4.3.1/lib/puma/binder.rb
第233行附近:

#
def add_tcp_侦听器(主机、端口、优化_以获得_延迟=true、积压=1024)
如果主机==“localhost”
环回地址。每个do地址|
添加\u tcp\u侦听器地址、端口、优化\u延迟、积压
结束
返回
结束
主机=主机[1..-2]如果主机和主机[0..0]='['
#猴子补丁从这里开始
主机='127.0.0.1'
端口=3000
#猴子补丁到此结束
s=TCPServer.new(主机、端口)
#如果要优化\u的延迟
s、 setsockopt(套接字::IPPROTO_TCP,套接字::TCP_节点延迟,1)
#结束
#s.setsockopt(套接字::SOL_套接字,套接字::SO_REUSEADDR,true)
s、 倾听积压
@已连接的_端口=s.addr[1]

@你在运行WSL吗?我也有同样的错误