質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

1回答

938閲覧

Cloud9でRailsの投稿機能作成でエラーが出る

nisetogashi

総合スコア6

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/09/29 13:03

<前提・実現したいこと>
・エラーコードのどこの部分に解決の糸口になる問題点が書かれているか知りたい
・エラーの意味も詳しく知りたい

<質問の内容>
Cloud9を使ってサンプルでRailsでの投稿機能を作ろうとしています。
専用のテキストのコードを1から全てコピペして、実装しましたがエラーが出てしまったため、何度も1からやり直しましたが、同じようなエラーメッセージになるため、解決の糸口がいただきたいと思うます。全文コピペなので、スペルミスはないと思いますので、そもそもの設定やコードの書く場所などがおかしなことになっているのかどうか教えていただきたいです。

<発生している問題・エラーメッセージ>
=> Booting Puma
=> Rails 5.2.6 application starting in development
=> Run rails server -h for more startup options
Exiting
Traceback (most recent call last):
70: from bin/rails:3:in <main>' 69: from bin/rails:3:in load'
68: from /home/ec2-user/environment/sample_app/bin/spring:15:in <top (required)>' 67: from /home/ec2-user/environment/sample_app/bin/spring:15:in require'
66: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/binstub.rb:11:in <top (required)>' 65: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/binstub.rb:11:in load'
64: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/bin/spring:49:in <top (required)>' 63: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/client.rb:30:in run'
62: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/client/command.rb:7:in call' 61: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in call'
60: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in load' 59: from /home/ec2-user/environment/sample_app/bin/rails:9:in <top (required)>'
58: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' 57: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/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.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' 55: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/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.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' 53: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands.rb:18:in <main>'
52: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/command.rb:46:in invoke' 51: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/command/base.rb:69:in perform'
50: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' 49: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'
48: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.1.0/lib/thor/command.rb:27:in run' 47: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:142:in perform'
46: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:142:in tap' 45: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:147:in block in perform'
44: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:51:in start' 43: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:89:in log_to_stdout'
42: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:422:in wrapped_app' 41: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/commands/server/server_command.rb:27:in app'
40: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/server.rb:249:in app' 39: 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'
38: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:66:in parse_file' 37: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:105:in load_file'
36: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in new_from_string' 35: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/rack-2.2.3/lib/rack/builder.rb:116:in eval'
34: from config.ru:3:in block in <main>' 33: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in require_relative'
32: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' 31: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'
30: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' 29: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'
28: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' 27: from /home/ec2-user/environment/sample_app/config/environment.rb:5:in <main>'
26: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application.rb:361:in initialize!' 25: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/initializable.rb:60:in run_initializers'
24: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:205:in tsort_each' 23: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:226:in tsort_each'
22: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in each_strongly_connected_component' 21: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in call'
20: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in each' 19: 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'
18: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:431:in each_strongly_connected_component_from' 17: 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'
16: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:228:in block in tsort_each' 15: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/initializable.rb:61:in block in run_initializers'
14: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/initializable.rb:32:in run' 13: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/initializable.rb:32:in instance_exec'
12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/finisher.rb:130:in block in <module:Finisher>' 11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:10:in execute'
10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-5.2.6/lib/active_support/file_update_checker.rb:83:in execute' 9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:30:in block in updater'
8: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:20:in reload!' 7: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in load_paths'
6: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in each' 5: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in block in load_paths'
4: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in load' 3: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in load_dependency'
2: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in block in load' 1: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in load'
/home/ec2-user/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load': /home/ec2-user/environment/sample_app/config/routes.rb:5: syntax error, unexpected tIDENTIFIER, expecting end (SyntaxError)
post 'todolists' => 'todolists#create'
^~~~~~~~~
/home/ec2-user/environment/sample_app/config/routes.rb:5: syntax error, unexpected tIDENTIFIER, expecting end-of-input
... post 'todolists' => 'todolists#create'
... ^~~~~~~~~

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

エラー最後の部分(以下の部分に書いてあると思われます)
configディレクトリ配下のroutes.rbの5行目でエラーを吐いています
SyntaxErrorは構文のエラーなのでクオンテーションがうまく囲えていなかったり、鉤括弧がうまくかこえていなかったりするとこのエラーを出力します

load: /home/ec2-user/environment/sample_app/config/routes.rb:5: syntax error, unexpected tIDENTIFIER, expecting end (SyntaxError)

投稿2021/09/29 13:08

編集2021/09/29 13:13
S.Hashimoto

総合スコア65

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

nisetogashi

2021/09/29 13:13

即レスありがとうございます! 最後の部分ですね。調べてみます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問