Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

rails sができません

rails server コマンドを実行しようとすると、エラーが出ます

正直何がダメでエラーが出ているのかわかりません。。

=> Booting Puma
=> Rails 6.1.4.6 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
Traceback (most recent call last):
        61: from bin/rails:2:in `<main>'
        60: from bin/rails:2:in `load'
        59: from /home/ec2-user/environment/stamping_life/bin/spring:7:in `<top (required)>'
        58: from /home/ec2-user/environment/stamping_life/bin/spring:7:in `tap'
        57: from /home/ec2-user/environment/stamping_life/bin/spring:10:in `block in <top (required)>'
        56: from /home/ec2-user/environment/stamping_life/bin/spring:10:in `require'
        55: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        54: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `load'
        53: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/bin/spring:49:in `<top (required)>'
        52: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client.rb:30:in `run'
        51: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/command.rb:7:in `call'
        50: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `call'
        49: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `load'
        48: from /home/ec2-user/environment/stamping_life/bin/rails:5:in `<top (required)>'
        47: 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'
        46: 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'
        45: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands.rb:18:in `<main>'
        44: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/command.rb:48:in `invoke'
        43: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/command/base.rb:69:in `perform'
        42: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        41: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        40: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        39: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:135:in `perform'
        38: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:135:in `tap'
        37: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:144:in `block in perform'
        36: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:37:in `start'
        35: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
        34: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
        33: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
        32: 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'
        31: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
        30: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
        29: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
        28: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
        27: from config.ru:3:in `block in <main>'
        26: from config.ru:3:in `require_relative'
        25: from /home/ec2-user/environment/stamping_life/config/environment.rb:5:in `<main>'
        24: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/application.rb:391:in `initialize!'
        23: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:60:in `run_initializers'
        22: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        21: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        20: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        19: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
        18: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
        17: 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'
        16: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        15: 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'
        14: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        13: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:61:in `block in run_initializers'
        12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:32:in `run'
        11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:32:in `instance_exec'
        10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie.rb:169:in `block in <class:Railtie>'
         9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie.rb:33:in `initialize!'
         8: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie_methods.rb:55:in `get_webpacker_assets_path'
         7: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker.rb:34:in `config'
         6: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/instance.rb:18:in `config'
         5: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/instance.rb:11:in `env'
         4: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:7:in `inquire'
         3: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:15:in `inquire'
         2: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:21:in `current'
         1: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.4.6/lib/active_support/core_ext/object/inclusion.rb:27:in `presence_in'
/home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.4.6/lib/active_support/core_ext/object/inclusion.rb:13:in `in?': undefined method `include?' for false:FalseClass (NoMethodError)
        62: from bin/rails:2:in `<main>'
        61: from bin/rails:2:in `load'
        60: from /home/ec2-user/environment/stamping_life/bin/spring:7:in `<top (required)>'
        59: from /home/ec2-user/environment/stamping_life/bin/spring:7:in `tap'
        58: from /home/ec2-user/environment/stamping_life/bin/spring:10:in `block in <top (required)>'
        57: from /home/ec2-user/environment/stamping_life/bin/spring:10:in `require'
        56: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        55: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/binstub.rb:11:in `load'
        54: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/bin/spring:49:in `<top (required)>'
        53: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client.rb:30:in `run'
        52: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/command.rb:7:in `call'
        51: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `call'
        50: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-3.1.1/lib/spring/client/rails.rb:30:in `load'
        49: from /home/ec2-user/environment/stamping_life/bin/rails:5:in `<top (required)>'
        48: 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'
        47: 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'
        46: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands.rb:18:in `<main>'
        45: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/command.rb:48:in `invoke'
        44: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/command/base.rb:69:in `perform'
        43: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        42: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        41: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        40: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:135:in `perform'
        39: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:135:in `tap'
        38: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:144:in `block in perform'
        37: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:37:in `start'
        36: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
        35: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
        34: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
        33: 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'
        32: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
        31: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
        30: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
        29: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
        28: from config.ru:3:in `block in <main>'
        27: from config.ru:3:in `require_relative'
        26: from /home/ec2-user/environment/stamping_life/config/environment.rb:5:in `<main>'
        25: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/application.rb:391:in `initialize!'
        24: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:60:in `run_initializers'
        23: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        22: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        21: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        20: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
        19: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
        18: 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'
        17: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        16: 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'
        15: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        14: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:61:in `block in run_initializers'
        13: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:32:in `run'
        12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-6.1.4.6/lib/rails/initializable.rb:32:in `instance_exec'
        11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie.rb:169:in `block in <class:Railtie>'
        10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie.rb:33:in `initialize!'
         9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-mini-profiler-2.3.4/lib/mini_profiler_rails/railtie_methods.rb:55:in `get_webpacker_assets_path'
         8: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker.rb:34:in `config'
         7: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/instance.rb:18:in `config'
         6: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/instance.rb:11:in `env'
         5: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:7:in `inquire'
         4: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:15:in `inquire'
         3: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/webpacker-5.4.3/lib/webpacker/env.rb:21:in `current'
         2: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.4.6/lib/active_support/core_ext/object/inclusion.rb:27:in `presence_in'
         1: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.4.6/lib/active_support/core_ext/object/inclusion.rb:12:in `in?'
/home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-6.1.4.6/lib/active_support/core_ext/object/inclusion.rb:15:in `rescue in in?': The parameter passed to #in? must respond to #include? (ArgumentError)

エラー全文を載せると長いのですが、サーバーを立ち上げる前に rials webpacker:installしました。その後に$rails s をしたらエラーが出ました。

様々な記事を調べましたが、詳しい解決方法が一切載っていなかったので誰か助けてほしいです。

ざっくりとした質問で申し訳ありませんがよろしくお願い致します。

0

1Answer

@motohashi_ryuto さん
yarnは環境に入っていますでしょうか?
yarnが入っていない場合、webpacker周りのエラーが出ることがあります。

私の記事ですが、もし参考になれば
https://qiita.com/RoaaaA/items/d57dccea1ec04ca3ae06

yarn導入後、rails newでプロジェクトを作り直すと、webpackerが正常に導入され、おそらくrails s できるようになるかと思います。

0Like

Your answer might help someone💌