无法启动Ruby on Rails服务器

问题描述 投票:0回答:2
$ 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
ruby-on-rails ruby server
2个回答
2
投票

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


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

然后尝试再次启动服务器。

© www.soinside.com 2019 - 2024. All rights reserved.