

`rails s` を実行しようとすると以下のエラーが表示されて困っています。

調べたところ、すでにサーバーが起動しているとのことだったのでkillコマンドを用いて停止させるためのプロセスコマンドを調べられるpsコマンドを入力したところ以下が実行されましたがどれを入力すればいいか分かりません。  
何方か教えていただけますと幸いです。

`ps` コマンドの実行結果

[code]

    22912 pts/1    00:00:00 bash
    22913 pts/1    00:00:00 bash
    31805 pts/1    00:00:00 ps
    
[/code]

`rails s` 実行時のエラーメッセージ

[code]

    voclabs:~/environment/bookers (master) $ rails s
    => Booting Puma
    => Rails 6.1.5.1 application starting in development 
    => Run `bin/rails server --help` for more startup options
    Exiting
    Traceback (most recent call last):
            82: from bin/rails:2:in `<main>'
            81: from bin/rails:2:in `load'
            80: from /home/ec2-user/environment/bookers/bin/spring:7:in `<top (required)>'
            79: from /home/ec2-user/environment/bookers/bin/spring:7:in `tap'
            78: from /home/ec2-user/environment/bookers/bin/spring:10:in `block in <top (required)>'
            77: from /home/ec2-user/environment/bookers/bin/spring:10:in `require'
            76: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
            75: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `load'
            74: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/bin/spring:49:in `<top (required)>'
            73: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client.rb:30:in `run'
            72: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/command.rb:7:in `call'
            71: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `call'
            70: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `load'
            69: from /home/ec2-user/environment/bookers/bin/rails:5:in `<top (required)>'
            68: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            67: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            66: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands.rb:18:in `<main>'
            65: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/command.rb:48:in `invoke'
            64: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/command/base.rb:69:in `perform'
            63: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
            62: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
            61: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
            60: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands/server/server_command.rb:135:in `perform'
            59: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands/server/server_command.rb:135:in `tap'
            58: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands/server/server_command.rb:144:in `block in perform'
            57: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands/server/server_command.rb:37:in `start'
            56: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
            55: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
            54: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
            53: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
            52: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
            51: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
            50: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
            49: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
            48: from config.ru:3:in `block in <main>'
            47: from config.ru:3:in `require_relative'
            46: from /home/ec2-user/environment/bookers/config/environment.rb:5:in `<main>'
            45: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application.rb:391:in `initialize!'
            44: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/initializable.rb:60:in `run_initializers'
            43: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
            42: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
            41: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
            40: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
            39: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
            38: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
            37: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
            36: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
            35: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
            34: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/initializable.rb:61:in `block in run_initializers'
            33: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/initializable.rb:32:in `run'
            32: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/initializable.rb:32:in `instance_exec'
            31: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/finisher.rb:195:in `block in <module:Finisher>'
            30: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:10:in `execute'
            29: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.5.1/lib/active_support/file_update_checker.rb:83:in `execute'
            28: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:35:in `block in updater'
            27: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:21:in `reload!'
            26: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:47:in `load_paths'
            25: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:47:in `each'
            24: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:47:in `block in load_paths'
            23: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
            22: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
            21: from /home/ec2-user/environment/bookers/config/routes.rb:1:in `<main>'
            20: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:409:in `draw'
            19: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:427:in `eval_block'
            18: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:427:in `instance_exec'
            17: from /home/ec2-user/environment/bookers/config/routes.rb:3:in `block in <main>'
            16: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:718:in `get'
            15: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:765:in `map_method'
            14: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1663:in `match'
            13: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1915:in `map_match'
            12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1915:in `each'
            11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1921:in `block in map_match'
            10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1957:in `decomposed_match'
             9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:1985:in `add_route'
    
[/code]


CC BY-SA 4.0
2022-05-08T14:43:25.330
88713
2022-05-09T01:14:58.950
2022-05-08T16:18:09.747
3060
52527
question
ruby-on-rails
rails s 起動しません


> 調べたところ、すでにサーバーが起動している

railsが起動済みの場合、複数起動すると以下のように表示されます。  
already runningのメッセージを確認してください。

[code]

    => Booting Puma
    => Rails 7.0.2.4 application starting in development 
    => Run `bin/rails server --help` for more startup options
    A server is already running. Check /Users/owner/Documents/ruby/app/app/tmp/pids/server.pid.
    Exiting
    
[/code]

railsの起動を確認するときはpsの出力結果からgrepでpumaを拾えばいいです。

[code]

    $ ps ax | grep puma
    8624 s000  S+     0:00.67 puma 5.6.4 (tcp://localhost:3000) [app]  
    8732 s001  S+     0:00.00 grep -i puma
    
[/code]


CC BY-SA 4.0
2022-05-08T18:00:06.977
88715
2022-05-09T01:14:58.950
2022-05-09T01:14:58.950
43005
43005
88713
answer