前提・実現したいこと
AWS cloud9でRuby on Rails でアプリケーション(sample_app)を開発中。
突如ターミナルでRails serverコマンドに対してエラーが出るようになりました。
エラーの解決方法を教えて頂きたいです。
発生している問題・エラーメッセージ
エラーメッセージ ubuntu:~/environment/sample_app (basic-login) $ rails s Could not find gem 'puma (= 4.3.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. ubuntu:~/environment/sample_app (basic-login) $ bundle install The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Bundler could not find compatible versions for gem "activesupport": In snapshot (Gemfile.lock): activesupport (= 6.0.0) In Gemfile: rails (= 6.0.3) was resolved to 6.0.3, which depends on activesupport (= 6.0.3) sass-rails (= 5.1.0) was resolved to 5.1.0, which depends on railties (>= 5.2.0) was resolved to 6.0.0, which depends on activesupport (= 6.0.0) Running `bundle update` will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.
該当のソースコード
Gemfile
1 2 3 4source 'https://rubygems.org' 5git_source(:github) { |xxxx| "https://github.com/#{xxxx}.git" } 6 7gem 'rails', '6.0.3' 8gem 'bootstrap-sass', '3.4.1' 9gem 'puma', '4.3.4' 10gem 'sass-rails', '5.1.0' 11gem 'webpacker', '4.0.7' 12gem 'turbolinks', '5.2.0' 13gem 'jbuilder', '2.9.1' 14gem 'bootsnap', '1.4.5', require: false 15 16group :development, :test do 17 gem 'sqlite3', '1.4.1' 18 gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] 19end 20 21group :development do 22 gem 'web-console', '4.0.1' 23 gem 'listen', '3.1.5' 24 gem 'spring', '2.1.0' 25 gem 'spring-watcher-listen', '2.0.1' 26end 27 28group :test do 29 gem 'capybara', '3.28.0' 30 gem 'selenium-webdriver', '3.142.4' 31 gem 'webdrivers', '4.1.2' 32 gem 'rails-controller-testing', '1.0.4' 33 gem 'minitest', '5.11.3' 34 gem 'minitest-reporters', '1.3.8' 35 gem 'guard', '2.16.2' 36 gem 'guard-minitest', '2.4.6' 37end 38 39group :production do 40 gem 'pg', '1.1.4' 41end 42 43# Windows ではタイムゾーン情報用の tzinfo-data gem を含める必要があります 44gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
試したこと
・bundle install
・bundle update
・エラー文をコピペしてググりまくりましたが解決できませんでした。
補足情報(FW/ツールのバージョンなど)
rails '6.0.3'
ここにより詳細な情報を記載してください。
「突如ターミナルでRails serverコマンドに対してエラーが出るようになりました。」ってことは「動いていたのに」ですね?
その間に何をしたのか、も重要な情報です。載せてください
元々エラーが起こる前日までは普通に開発できていました。しかし翌日から突然サーバーで下記のエラーメッセージが表示されました。(翌日一発目のサーバー立ち上げでエラーが表示されました。)
(この時点ではターミナルでrails serverコマンドは実行できていました。)
ーーーーーエラーメッセージーーーーーーーー
ActiveRecord::ConnectionNotEstablished
No connection pool with ‘primary’ found.
ーーーーーーーーーーーーーーーーーーーーー
その後、ググりまくり、記事の載っていた解決方法や自分なりの解決方法を試しました。
・Cloud9の再起動
・Gemfile 'sqlite3', '~> 1.3.6' に変更後bundle install
・Gemfileの中身を全部消して再貼り付けしてbundle install
以上のことをやっていたらサーバーの立ち上げ(ターミナルでRails serverコマンド)にもエラーが出るようになってしまいました。