konchanxxx / menta

MENTAのタスク管理用リポジトリ
0 stars 0 forks source link

rails が起動しない #58

Closed hige-dev closed 5 years ago

hige-dev commented 5 years ago

概要

AWSでrails sなどが起動しない

実現したいこと

上記の解消

困っていること

rails チュートリアル3章で、rails new 5.1.6 sample_appとしたところ以下のようにエラーが出ました。 /home/ec2-user/environment/app_sample/config/boot.rb:4:inrequire': cannot load such file -- bootsnap/setup (LoadError) https://teratail.com/questions/139727 をみて、gemに gem 'bootsnap', '>= 1.1.0', require: false を追加しましたが、さらに以下のエラーが出ました。 /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/application/configuration.rb:81:in load_defaults': Unknown version "5.2" (RuntimeError) 上記ファイルno81行目をみてみるとraise "Unknown version #{target_version.to_s.inspect}"となっていました。そもそも1週目にはなかったエラーですが、何か間違えているのでしょうか? AWSはrails -v 5.1.6、ruby -v 2.5.3p105です。

*汚くてすいません。。

困っていることがバグの場合は事象やログ、エラーメッセージをできるだけそのまま(抜粋などしない)下記に記載してください。

> Traceback (most recent call last):
>         40: from bin/rails:3:in `<main>'
>         39: from bin/rails:3:in `load'
>         38: from /home/ec2-user/environment/app_sample/bin/spring:15:in `<top (required)>'
>         37: from /home/ec2-user/environment/app_sample/bin/spring:15:in `require'
>         36: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
>         35: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
>         34: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
>         33: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
>         32: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
>         31: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
>         30: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
>         29: from /home/ec2-user/environment/app_sample/bin/rails:9:in `<top (required)>'
>         28: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
>         27: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
>         26: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
>         25: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
>         24: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
>         23: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
>         22: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
>         21: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
>         20: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<main>'
>         19: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke'
>         18: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform'
>         17: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
>         16: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
>         15: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
>         14: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform'
>         13: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap'
>         12: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:133:in `block in perform'
>         11: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
>         10: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
>          9: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
>          8: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
>          7: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
>          6: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
>          5: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
>          4: from /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
>          3: from /home/ec2-user/environment/app_sample/config/application.rb:9:in `<main>'
>          2: from /home/ec2-user/environment/app_sample/config/application.rb:10:in `<module:AppSample>'
>          1: from /home/ec2-user/environment/app_sample/config/application.rb:12:in `<class:Application>'
> /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/railties-5.1.6/lib/rails/application/configuration.rb:81:in `load_defaults': Unknown version "5.2" (RuntimeError)

解決するために行ったこと

問題となっている箇所の予想

問題となっているアプリケーションのGitHub URL

konchanxxx commented 5 years ago

これですかね

https://qiita.com/cyborg__ninja/items/d15b50500f4ffb069feb

https://github.com/Shopify/bootsnap/issues/73

あとバージョン指定するときアンスコ_が必要な気がしました

https://qiita.com/itkrt2y/items/243a89472fa82d60d0ad

konchanxxx commented 5 years ago

@yas-github 確認お願いします:bow: コードは ``` で囲めば綺麗に表示されます:bow:

hige-dev commented 5 years ago

@rexitorg ありがとうございます。どちらも見て試しましたが駄目でした。(英語の方は漏れがあるかもですが。。) 正しく記載せずすいません、バージョン指定もそのようにしてます。 https://github.com/yas-github/app_sample

コードは ``` で囲めば綺麗に表示されます🙇

編集のとこにあるinsert codeじゃだめなんですね。。笑 次回からはそのようにします、ありがとうございます。

konchanxxx commented 5 years ago

これの通り設定を5.1に変えたらどうなりますか? https://qiita.com/shiroux/items/2b65ffc4972a47230c36

konchanxxx commented 5 years ago

@yas-github

hige-dev commented 5 years ago

諦めて一旦ローカルに環境構築しました。ありがとうございました。

konchanxxx commented 5 years ago

えーと、設定は試した感じでしょうか? ローカル環境は何れにしても構築しないといけないですね。最初からAWS上で開発することはないです:bow:

hige-dev commented 5 years ago

お返事ありがとうございます、また遅れてすいません。ローカル環境作れたのでそちらで進めてました。 もう一度アプリを削除して最初からやり直してみたところ、チュートリアルのbundle install --without productionのオプションをつけてなかったのかもしれません。。無事解決しました、初歩的なミス、大変失礼致しました。最後にいただいた情報はエラーを深掘りする際の考え方として参考にさせていただきます。