前提・実現したいこと
Ruby on railsにて、
rails sでローカルサーバーの動作確認がしたいです。
railsで、rails newをして新しいファイルを作成しました。
その後、rails sを実行しているのですが、エラーが解消できず困っています。
発生している問題・エラーメッセージ
=> Booting Puma => Rails 6.1.4 application starting in development => Run `bin/rails server --help` for more startup options Exiting Traceback (most recent call last): 72: from bin/rails:2:in `<main>' 71: from bin/rails:2:in `load' 70: from /home/ec2-user/environment/rails_projects/railsNewApp/bin/spring:7:in `<top (required)>' 69: from /home/ec2-user/environment/rails_projects/railsNewApp/bin/spring:7:in `tap' 68: from /home/ec2-user/environment/rails_projects/railsNewApp/bin/spring:10:in `block in <top (required)>' 67: from /home/ec2-user/environment/rails_projects/railsNewApp/bin/spring:10:in `require' 66: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>' 65: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load' 64: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/bin/spring:49:in `<top (required)>' 63: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/client.rb:30:in `run' 62: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call' 61: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call' 60: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load' 59: from /home/ec2-user/environment/rails_projects/railsNewApp/bin/rails:5:in `<top (required)>' 58: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 57: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 56: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 55: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 54: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 53: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands.rb:18:in `<top (required)>' 52: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/command.rb:48:in `invoke' 51: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/command/base.rb:69:in `perform' 50: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch' 49: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command' 48: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/thor-1.1.0/lib/thor/command.rb:27:in `run' 47: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:135:in `perform' 46: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:135:in `tap' 45: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:144:in `block in perform' 44: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:37:in `start' 43: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout' 42: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app' 41: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/server.rb:249:in `app' 40: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config' 39: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file' 38: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file' 37: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string' 36: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval' 35: from config.ru:3:in `block in <main>' 34: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative' 33: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:in `require' 32: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:299:in `load_dependency' 31: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:in `block in require' 30: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' 29: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 28: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 27: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 26: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 25: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 24: from /home/ec2-user/environment/rails_projects/railsNewApp/config/environment.rb:5:in `<top (required)>' 23: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/application.rb:391:in `initialize!' 22: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/initializable.rb:60:in `run_initializers' 21: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each' 20: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each' 19: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component' 18: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call' 17: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each' 16: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component' 15: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from' 14: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 13: from /home/ec2-user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each' 12: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/initializable.rb:61:in `block in run_initializers' 11: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/initializable.rb:32:in `run' 10: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/railties-6.1.4/lib/rails/initializable.rb:32:in `instance_exec' 9: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-mini-profiler-2.3.2/lib/mini_profiler_rails/railtie.rb:169:in `block in <class:Railtie>' 8: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-mini-profiler-2.3.2/lib/mini_profiler_rails/railtie.rb:33:in `initialize!' 7: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/rack-mini-profiler-2.3.2/lib/mini_profiler_rails/railtie_methods.rb:55:in `get_webpacker_assets_path' 6: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker.rb:34:in `config' 5: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker/instance.rb:18:in `config' 4: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker/instance.rb:11:in `env' 3: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker/env.rb:7:in `inquire' 2: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker/env.rb:16:in `inquire' 1: from /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/webpacker-5.4.0/lib/webpacker/env.rb:21:in `current' /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/activesupport-6.1.4/lib/active_support/string_inquirer.rb:31:in `method_missing': undefined method `presence_in' for "development":ActiveSupport::EnvironmentInquirer (NoMethodError) Did you mean? presence
該当のソースコード
ソースコード
試したこと
このエラーメッセージは、一度別のエラーを解消した後のものです。
ページが遡れなくなってしまいメッセージの記載ができないのですが、
初めに実行した時はRuntimeErrorが出ていました。
その際、webpackerをインストールする用のファイルが存在しておらず、インストールもされていない旨がエラーメッセージに記載されていたので、
指定の場所にwebpacker.ymlファイルを作り、rails webpacker:install でインストールしました。
その後、今回のエラーメッセージが表示されるようになりました。
メッセージ末尾に記載の、
/home/ec2-user//.rvm/gems/ruby-2.5.1/gems/activesupport-6.1.4/lib/active_support/string_inquirer.rb
ファイルをviエディタで開き、中身を見てみました。
しかし、メソッドが使えないのであろうpresenceや,
developmentの単語の記載もなく、どうすればいいか分からない状況です。
同じようなエラーの記事等も見つけられず、質問に至りました。
お恥ずかしい内容の質問でしたら申し訳ありません。
ご回答のほどよろしくお願いいたします。
補足情報(FW/ツールのバージョンなど)
AWS Cloud9のターミナル上で実行しています。
rubyはバージョン2.5.1、railsはバージョン6.1.4です。
あなたの回答
tips
プレビュー