无法启动Ruby on Rails服务器

时间:2019-11-30 01:36:17

标签: ruby-on-rails ruby server

$ rails s
=> Booting Puma
=> Rails 6.0.1 application starting in development
=> Run `rails server --help` 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 4.3.0 (ruby 2.6.5-p114), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
Exiting
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:229:in `initialize': Only     one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) for "::1" port 3000 (Errno::EADDRINUSE)
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:229:in `new'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:229:in `add_tcp_listener'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:223:in `block in add_tcp_listener'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:222:in `each'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:222:in `add_tcp_listener'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:106:in `block in parse'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:90:in `each'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:90:in `parse'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/runner.rb:161:in `load_and_bind'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/single.rb:98:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/launcher.rb:172:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/rack/handler/puma.rb:73:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/commands/server/server_command.rb:39:in `start'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/commands/server/server_command.rb:138:in `tap'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/commands/server/server_command.rb:138:in `perform'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/command/base.rb:65:in `perform'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/command.rb:46:in `invoke'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

有我的错误消息。我试图遵循YouTube教程来制作Ruby on Rails网站。每次我做rails server时,都会得到提示。

$ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]

$ rails -v
Rails 6.0.1

3 个答案:

答案 0 :(得分:2)

错误消息告诉您,已经有其他东西使用该地址(TCP [::1]:3000)。您需要使用其他地址或关闭使用该地址的其他地址。

答案 1 :(得分:0)

如果您正在运行* nix服务器,则可以尝试:

lsof -i TCP:3000

如果看到任何结果,请终止该进程:即

lsof -i TCP:3000

COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    94653 lacoste   11u  IPv4 0x5bcb7eb170442691      0t0  TCP 
localhost:hbci (LISTEN)

所以杀死它/他们

kill -9 94653

然后尝试重新启动服务器。

答案 2 :(得分:0)

在 Linux 终端执行 lsof -i TCP:3000 以“杀死”服务器进程,它对我使用适用于 Linux 的 Windows 子系统有效