実現したいこと
bin/rails s でwebページを表示したい。
前提
参考書の通りに
gitから日本語翻訳ファイルをダウンロード。その後エラー対象?であるlocale.rbファイルを作成。
$ wget https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml --output-file=config/locales/ja.yml
開発環境
・Windows 10
・Linux
・Ubuntu
・ruby 2.5.1p57
・Rails 5.2.3
発生している問題・エラーメッセージ
/taskleaf$ bin/rails s => Booting Puma => Rails 5.2.3 application starting in development => Run `rails server -h` for more startup options Exiting Traceback (most recent call last): 84: from bin/rails:3:in `<main>' 83: from bin/rails:3:in `load' 82: from /home/sayuiso/railsTest/taskleaf/bin/spring:15:in `<top (required)>' 81: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require' 80: /lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require' 79: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>' 78: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load' 77: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>' 76: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run' 75: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call' 74: /lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call' 73: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load' 72: from /home/sayuiso/railsTest/taskleaf/bin/rails:9:in `<top (required)>' 71: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 70: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 69: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 68: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' 67: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' 66: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 65: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' 64: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' 63: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>' 62: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke' 61: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform' 60: /lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' 59: /lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' 58: /lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' 57: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform' 56: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap' 55: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:147:in `block in perform' 54: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:51:in `start' 53: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout' 52: /lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app' 51: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:27:in `app' 50: /lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app' 49: /lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config' 48: /lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file' 47: /lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string' 46: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval' 45: from config.ru:in `<main>' 44: from config.ru:in `new' 43: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize' 42: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval' 41: from config.ru:3:in `block in <main>' 40: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative' 39: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 38: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 37: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 36: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' 35: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' 34: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 33: /lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' 32: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' 31: from /home/sayuiso/railsTest/taskleaf/config/environment.rb:5:in `<top (required)>' 30: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!' 29: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers' 28: /lib/ruby/2.5.0/tsort.rb:205:in `tsort_each' 27: /lib/ruby/2.5.0/tsort.rb:226:in `tsort_each' 26: /lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component' 25: /lib/ruby/2.5.0/tsort.rb:347:in `call' 24: /2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each' 23: /2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component' 22: /2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from' 21: /2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `call' 20: /2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child' 19: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each' 18: /lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from' 17: /lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from' 16: /lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' 15: /lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 14: /lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each' 13: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers' 12: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run' 11: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec' 10: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>' 9: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each' 8: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>' 7: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer' 6: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument' 5: /lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer' 4: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 3: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 2: /lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load' 1: from /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load' /home/sayuiso/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load': cannot load such file -- /home/sayuiso/railsTest/taskleaf/config/initializers/locale.rb (LoadError)
/taskleaf/config/initializers/locale.rb
Rails.application.config.i18n.default_locale = :ja
試したこと
エラーにはconfigファイルにあるlocale.rb が読み込めないとあるので、ファイルがないのかなと確認。するとファイルはあるし、中身もしっかりと書かれている。
補足情報
文字数の関係でtraceback中の重複箇所を削除しています。
from /home/sayuiso/.rbenv/versions/2.5.1 この文字列です。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。