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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

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

Q&A

解決済

1回答

499閲覧

AWSでrails consoleが動かない

Yuuki2918

総合スコア17

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

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

0グッド

0クリップ

投稿2019/06/02 08:29

Rails チュートリアルをAWSを使って学習中です。
作業途中で一度席を離れ、再度学習をしようとrails consoleを起動しようとするとエラーが出るようになりました。

対処方法と、そもそもなぜ起こってしまったのか(どうすれば防止できるのか)が知りたく質問致しました。
ご回答頂けたら幸いです。

エラー発生後、いくつか自分なりに対処をしたので順を追って記述します。

rails console

Traceback (most recent call last): 4: from /home/ec2-user/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>' 3: from /home/ec2-user/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval' 2: from /home/ec2-user/.rvm/gems/ruby-2.6.3/bin/rails:23:in `<main>' 1: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path' /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)

その時点で新しいターミナルを開くと上部にエラーが出ていました。

Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see: https://github.com/rvm/rvm/issues/3212

こちらのページを参考しにして対処しました

~/.bashrcファイルに以下の行を追加する。

export PATH=$PATH':/path/to/add' export GEM_HOME=$HOME/.gem export GEM_PATH=$HOME/.gem

その後、ターミナル上部のエラーは消えたのですが、
その後もエラーは変わらず出ていたので、gemfileがおかしくなったのかと思い、bundle installbundle updateを行いました。

ec2-user:~/environment/sample_app (sign-up) $ bundle install

Fetching

1Your bundle is locked to ffi (1.11.0), but that version could not be found 2in any of the sources listed in your Gemfile. If you haven't changed 3sources, that means the author of ffi (1.11.0) has removed it. You'll need 4to update your bundle to a version other than ffi (1.11.0) that hasn't 5been removed in order to install. 6

この時点でffiというgemfile?が何かエラーを起こしているのはわかったのですが、とりあえずupdateしてみました。
ec2-user:~/environment/sample_app (sign-up) $ bundle update

Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies.... Fetching rake 12.3.2 Installing rake 12.3.2 Fetching concurrent-ruby 1.1.5 Installing concurrent-ruby 1.1.5 Fetching i18n 1.6.0 Installing i18n 1.6.0 Fetching minitest 5.10.3 Installing minitest 5.10.3 Fetching thread_safe 0.3.6 Installing thread_safe 0.3.6 Fetching tzinfo 1.2.5 Installing tzinfo 1.2.5 Fetching activesupport 5.1.6 Installing activesupport 5.1.6 Fetching builder 3.2.3 Installing builder 3.2.3 Fetching erubi 1.8.0 Installing erubi 1.8.0 Fetching mini_portile2 2.4.0 Installing mini_portile2 2.4.0 Fetching nokogiri 1.10.3 Installing nokogiri 1.10.3 with native extensions Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.4 Installing crass 1.0.4 Fetching loofah 2.2.3 Installing loofah 2.2.3 Fetching rails-html-sanitizer 1.0.4 Installing rails-html-sanitizer 1.0.4 Fetching actionview 5.1.6 Installing actionview 5.1.6 Fetching rack 2.0.7 Installing rack 2.0.7 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 5.1.6 Installing actionpack 5.1.6 Fetching nio4r 2.3.1 Installing nio4r 2.3.1 with native extensions Fetching websocket-extensions 0.1.3 Installing websocket-extensions 0.1.3 Fetching websocket-driver 0.6.5 Installing websocket-driver 0.6.5 with native extensions Fetching actioncable 5.1.6 Installing actioncable 5.1.6 Fetching globalid 0.4.2 Installing globalid 0.4.2 Fetching activejob 5.1.6 Installing activejob 5.1.6 Fetching mini_mime 1.0.1 Installing mini_mime 1.0.1 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailer 5.1.6 Installing actionmailer 5.1.6 Fetching activemodel 5.1.6 Installing activemodel 5.1.6 Fetching arel 8.0.0 Installing arel 8.0.0 Fetching activerecord 5.1.6 Installing activerecord 5.1.6 Fetching ansi 1.5.0 Installing ansi 1.5.0 Fetching execjs 2.7.0 Installing execjs 2.7.0 Fetching autoprefixer-rails 9.5.1.1 Installing autoprefixer-rails 9.5.1.1 Fetching bcrypt 3.1.12 Installing bcrypt 3.1.12 with native extensions Fetching bindex 0.7.0 Installing bindex 0.7.0 with native extensions Fetching rb-fsevent 0.10.3 Installing rb-fsevent 0.10.3 Fetching ffi 1.11.1 (was 1.11.0) Installing ffi 1.11.1 (was 1.11.0) with native extensions Fetching rb-inotify 0.10.0 Installing rb-inotify 0.10.0 Fetching sass-listen 4.0.0 Installing sass-listen 4.0.0 Fetching sass 3.7.4 Installing sass 3.7.4 Fetching bootstrap-sass 3.3.7 Installing bootstrap-sass 3.3.7 Using bundler 2.0.1 Fetching byebug 9.0.6 Installing byebug 9.0.6 with native extensions Fetching coderay 1.1.2 Installing coderay 1.1.2 Fetching coffee-script-source 1.12.2 Installing coffee-script-source 1.12.2 Fetching coffee-script 2.4.1 Installing coffee-script 2.4.1 Fetching method_source 0.9.2 Installing method_source 0.9.2 Fetching thor 0.20.3 Installing thor 0.20.3 Fetching railties 5.1.6 Installing railties 5.1.6 Fetching coffee-rails 4.2.2 Installing coffee-rails 4.2.2 Fetching formatador 0.2.5 Installing formatador 0.2.5 Fetching ruby_dep 1.5.0 Installing ruby_dep 1.5.0 Fetching listen 3.1.5 Installing listen 3.1.5 Fetching lumberjack 1.0.13 Installing lumberjack 1.0.13 Fetching nenv 0.3.0 Installing nenv 0.3.0 Fetching shellany 0.0.1 Installing shellany 0.0.1 Fetching notiffany 0.1.1 Installing notiffany 0.1.1 Fetching pry 0.12.2 Installing pry 0.12.2 Fetching guard 2.13.0 Installing guard 2.13.0 Fetching guard-compat 1.2.1 Installing guard-compat 1.2.1 Fetching guard-minitest 2.4.4 Installing guard-minitest 2.4.4 Fetching multi_json 1.13.1 Installing multi_json 1.13.1 Fetching jbuilder 2.7.0 Installing jbuilder 2.7.0 Fetching jquery-rails 4.3.1 Installing jquery-rails 4.3.1 Fetching ruby-progressbar 1.10.1 (was 1.10.0) Installing ruby-progressbar 1.10.1 (was 1.10.0) Fetching minitest-reporters 1.1.14 Installing minitest-reporters 1.1.14 Fetching puma 3.9.1 Installing puma 3.9.1 with native extensions Fetching sprockets 3.7.2 Installing sprockets 3.7.2 Fetching sprockets-rails 3.2.1 Installing sprockets-rails 3.2.1 Fetching rails 5.1.6 Installing rails 5.1.6 Fetching rails-controller-testing 1.0.2 Installing rails-controller-testing 1.0.2 Fetching tilt 2.0.9 Installing tilt 2.0.9 Fetching sass-rails 5.0.6 Installing sass-rails 5.0.6 Fetching spring 2.0.2 Installing spring 2.0.2 Fetching spring-watcher-listen 2.0.1 Installing spring-watcher-listen 2.0.1 Fetching sqlite3 1.3.13 Installing sqlite3 1.3.13 with native extensions Fetching turbolinks-source 5.2.0 Installing turbolinks-source 5.2.0 Fetching turbolinks 5.0.1 Installing turbolinks 5.0.1 Fetching uglifier 3.2.0 Installing uglifier 3.2.0 Fetching web-console 3.5.1 Installing web-console 3.5.1 Bundle updated! Gems in the group production were not installed. Post-install message from i18n: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. But that may break your application. Please check your Rails app for 'config.i18n.fallbacks = true'. If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be 'config.i18n.fallbacks = [I18n.default_locale]'. If not, fallbacks will be broken in your app by I18n 1.1.x. For more info see: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 Post-install message from sass: Ruby Sass has reached end-of-life and should no longer be used. * If you use Sass as a command-line tool, we recommend using Dart Sass, the new primary implementation: https://sass-lang.com/install * If you use Sass as a plug-in for a Ruby web framework, we recommend using the sassc gem: https://github.com/sass/sassc-ruby#readme * For more details, please refer to the Sass blog: https://sass-lang.com/blog/posts/7828841

この後、rails console
を叩くと違うエラーが出ます。

ec2-user:~/environment/sample_app (sign-up) $ rails console

Could not find ffi-1.11.1 in any of the sources Run `bundle install` to install missing gems.

どうやらffiの1.11.1が見つからないようなのです。
Gemfile内には記述がなく、
Gemfile.lock内を検索した際にそれらしきものは発見しています。

ffi (1.11.1)
なお、現在はrails チュートリアル4版(rails5.1)の7章を行っていました。
bitbucketに置いていた6章の終わりにコミットしたGemfile.lockも確認して見た所、そちらは
ffi (1.11.0)でした。
現在、チュートリアルを見よう見まねで学習中で、Gemfileなどはチュートリアル内で指示がない限り触っていません。
このエラーを読むと、Gemfile内にffi (1.11.1)を記述してbundle installを行えば良さそうかと思ったのですが、あってますでしょうか?
これ以上複雑なことをしていまい、取り返しがつかなくなるのが怖く、Gemfileはまだ変更を加えておりません。

何が悪いかわからない状態なのでわかる範囲で情報をかきました。アドバイスいただけたら幸いです。

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

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

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

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

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

guest

回答1

0

ベストアンサー

同じエラーがおきました。
私の場合、Railsチュートリアルのgemは、必要最低限の特定バージョンなので、gemファイルはそのまま変更せず、bundle installのみ再度行うと、サーバーを起動できました。
gemファイルを書き換えてしまった場合、Railsチュートリアルでインストールしたgem(リスト 3.2、リスト 5.5、リスト 6.36)を貼り付けて、bundle install。

投稿2019/06/18 23:31

excelrpa

総合スコア17

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

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

Yuuki2918

2019/07/03 14:21 編集

回答が遅れてしまい申し訳ありません。 その後bundle installをして無事動作しました。 ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問