首页 > 解决方案 > Ruby 语言的新手并在 Windows 8.1 上安装了 Ruby 和 rails,但是当 rails 服务器出现以下错误时

问题描述

=> Booting Puma
=> Rails 5.1.6 application starting in development
=> Run `rails server -h` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.12.0 (ruby 2.3.3-p222), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Exiting
G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/puma-3.12.0/lib/
puma/binder.rb:272:in `initialize': Only one usage of each socket address (proto
col/network address/port) is normally permitted. - bind(2) for "0.0.0.0" port 30
00 (Errno::EADDRINUSE)
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/binder.rb:272:in `new'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/binder.rb:272:in `add_tcp_listener'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/binder.rb:105:in `block in parse'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/binder.rb:88:in `each'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/binder.rb:88:in `parse'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/runner.rb:151:in `load_and_bind'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/single.rb:96:in `run'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/puma/launcher.rb:184:in `run'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pum
a-3.12.0/lib/rack/handler/puma.rb:70:in `run'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rac
k-2.0.5/lib/rack/server.rb:297:in `start'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/commands/server/server_command.rb:44:in `start'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/commands/server/server_command.rb:135:in `block in perform
'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tho
r-0.20.0/lib/thor/command.rb:27:in `run'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tho
r-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tho
r-0.20.0/lib/thor.rb:387:in `dispatch'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/command/base.rb:63:in `perform'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/command.rb:44:in `invoke'
        from G:/xampp/ruby/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rai
lties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

但是当我运行http://localhost:3000它显示无法访问此站点

标签: ruby-on-rails

解决方案


Errno::EADDRINUSE 表示套接字已在使用中。这意味着你已经开始 puma 了。您需要在重新启动之前停止所有以前的 puma 实例。看

如何查找套接字列表

如何关闭一个 tcp 端口


推荐阅读