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

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

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

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

Ruby

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

Q&A

3回答

12145閲覧

rails sでサーバーが起動しない

Reiji

総合スコア15

Ruby on Rails 5

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

Ruby

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

0グッド

0クリップ

投稿2019/03/13 16:50

編集2019/03/16 17:24

rails sでサーバーが起動しません。
「rails s」を行い、localhost:3000にアクセスした画面が以下です。
イメージ説明

エラーコードを調べたところ、https://qiita.com/Kta-M/items/254a1ba141827a989cb7のサイトにたどり着いたので、指示にあるようにgemfileを書き換え、bundle installを行いましたが、状況は変わりませんでした。

次にrails s -dでバックグラウンドで立ち上げた結果が以下の画面です。
![イメージ説明

試したこと

上記にもありますが、gemfileを書き換えました。また、 https://qiita.com/Ago0727/items/325df5e39e3406fa16d2 にあるようにvagrantfileを書き換え、firewallも停止しました。ここ2,3日ほどいじっていますが、進展もなく、原因も解決策も全くわからない状態です。

###Gemfileの内容

Ruby

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '2.6.1' 5 6# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7gem 'rails', '~> 5.2.2' 8# Use sqlite3 as the database for Active Record 9gem 'sqlite3', '~> 1.3.6' 10# Use Puma as the app server 11gem 'puma', '~> 3.11' 12# Use SCSS for stylesheets 13gem 'sass-rails', '~> 5.0' 14# Use Uglifier as compressor for JavaScript assets 15gem 'uglifier', '>= 1.3.0' 16# See https://github.com/rails/execjs#readme for more supported runtimes 17# gem 'mini_racer', platforms: :ruby 18 19# Use CoffeeScript for .coffee assets and views 20gem 'coffee-rails', '~> 4.2' 21# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 22gem 'turbolinks', '~> 5' 23# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 24gem 'jbuilder', '~> 2.5' 25# Use Redis adapter to run Action Cable in production 26# gem 'redis', '~> 4.0' 27# Use ActiveModel has_secure_password 28# gem 'bcrypt', '~> 3.1.7' 29 30# Use ActiveStorage variant 31# gem 'mini_magick', '~> 4.8' 32 33# Use Capistrano for deployment 34# gem 'capistrano-rails', group: :development 35 36# Reduces boot times through caching; required in config/boot.rb 37gem 'bootsnap', '>= 1.1.0', require: false 38 39group :development, :test do 40 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 41 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 42end 43 44group :development do 45 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 46 gem 'web-console', '>= 3.3.0' 47 gem 'listen', '>= 3.0.5', '< 3.2' 48 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 49 gem 'spring' 50 gem 'spring-watcher-listen', '~> 2.0.0' 51end 52 53group :test do 54 # Adds support for Capybara system testing and selenium driver 55 gem 'capybara', '>= 2.15' 56 gem 'selenium-webdriver' 57 # Easy installation and use of chromedriver to run system tests with Chrome 58 gem 'chromedriver-helper' 59end 60 61# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 62gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

###bundleを行った時の結果

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`. Using rake 12.3.2 Using concurrent-ruby 1.1.5 Using i18n 1.6.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.2.2.1 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.1 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 5.2.2.1 Using rack 2.0.6 Using rack-test 1.1.0 Using actionpack 5.2.2.1 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.7.0 Using actioncable 5.2.2.1 Using globalid 0.4.2 Using activejob 5.2.2.1 Using mini_mime 1.0.1 Using mail 2.7.1 Using actionmailer 5.2.2.1 Using activemodel 5.2.2.1 Using arel 9.0.0 Using activerecord 5.2.2.1 Using mimemagic 0.3.3 Using marcel 0.3.3 Using activestorage 5.2.2.1 Using public_suffix 3.0.3 Using addressable 2.6.0 Using io-like 0.3.0 Using archive-zip 0.12.0 Using bindex 0.5.0 Using msgpack 1.2.9 Using bootsnap 1.4.1 Using bundler 1.17.2 Using byebug 11.0.0 Using regexp_parser 1.3.0 Using xpath 3.2.0 Using capybara 3.14.0 Using ffi 1.10.0 Using childprocess 0.9.0 Using chromedriver-helper 2.1.0 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.2.2.1 Using coffee-rails 4.2.2 Using multi_json 1.13.1 Using jbuilder 2.8.0 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.0 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.12.0 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.2.1 Using rubyzip 1.2.2 Using sass-listen 4.0.0 Using sass 3.7.3 Using tilt 2.0.9 Using sass-rails 5.0.7 Using selenium-webdriver 3.141.0 Using spring 2.0.2 Using spring-watcher-listen 2.0.1 Using sqlite3 1.4.0 Using turbolinks-source 5.2.0 Using turbolinks 5.2.0 Using uglifier 4.1.20 Using web-console 3.7.0 Bundle complete! 18 Gemfile dependencies, 79 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed.

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

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

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

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

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

guest

回答3

0

gemfileの編集がきちんとできてない可能性が高いですね。
質問の内容を編集してgemfileの中身もコピペしてください。

gem 'sqlite3', '~> 1.3.6'

に出来てればインストールされるのは1.3.6になりますよ。

※新しくスレッドを立てるのではなく、質問を編集して情報を追加してくださいね。

投稿2019/03/13 21:41

編集2019/03/13 21:52
shuzi

総合スコア197

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

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

Reiji

2019/03/15 18:24

ありがとうございます。gemfileの内容を質問に追記させていただきました。
Reiji

2019/03/16 17:38

bundleを行った時の結果を追記させていただきました。 また、rails de:createを実行した時の結果を以下に書いておきます。 読んでみたところsqliteまわりのエラーっぽいのですが、ググってもイマイチわかりませんでした。 gemfileの内容は以前と変更していませんし、bundle updateも行っています。 rails aborted! LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. /home/vagrant/rails_lessons/myapp/bin/rails:9:in `<top (required)>' /home/vagrant/rails_lessons/myapp/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Caused by: Gem::LoadError: can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. /home/vagrant/rails_lessons/myapp/bin/rails:9:in `<top (required)>' /home/vagrant/rails_lessons/myapp/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Tasks: TOP => db:create => db:load_config (See full trace by running task with --trace)
shuzi

2019/03/20 07:52

あっ bundle updateもやってみましたか? 見ると Using sqlite3 1.4.0 になってますね。
guest

0

変更したgemが反映されていない可能性があります。
考えられることとしては、

$ rails s でサーバーを再起動する。

gemfileが反映されていないため、
$ bundle install ではなく、$ bundle updateをする。

vagrantを再起動してみる。
$ vagrant reload

をしてみてはいかがでしょうか?

投稿2019/03/13 17:02

THitokuse

総合スコア49

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

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

Reiji

2019/03/13 17:12

早速の回答ありがとうございます。全て試してみましたが、アクセスしてみるとActiveRecord::ConnectionNotEstablished (No connection pool with 'primary' found.):という赤い画面が出てきてしまいます。
THitokuse

2019/03/13 17:25

rails側のバージョン指定の問題みたいですね。 https://github.com/rails/rails/issues/35153 $ gem list | grep sqlite3 してみて1.4.0以上のバージョンが入っていますでしょうか? 仮に入っていた場合、 $ gem uninstall sqlite3 -v バージョン で行ってみてください。
Reiji

2019/03/13 17:45

1.4.0が入っていましたので、gem uninstall sqlite3 -v 1.4.0を行いました。その後rails sを行ったところ、Could not find sqlite3-1.4.0 in any of the sources. Run `bundle install` to install missing gems.と表示されました。それに従いbundle installを行ったところ、同じようにsqlite3の1.4.0がインストールされてしまいました。
THitokuse

2019/03/14 16:00

gem 'sqlite3', '~> 1.3.6' をgemfileで指定しているのにおかしいですね。 gemfile.lockの sqlite3のバージョンは1.3.6になっているでしょうか?
guest

0

このへん確認してみてはいかがでしょうか。
https://qiita.com/flowerhill/items/bb1e99bd87b151c0129b

/Library/Ruby/Gems/2.3.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in <main>'

% less /Library/Ruby/Gems/2.3.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb # frozen_string_literal: true require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/sqlite3/explain_pretty_printer" require "active_record/connection_adapters/sqlite3/quoting" require "active_record/connection_adapters/sqlite3/schema_creation" require "active_record/connection_adapters/sqlite3/schema_definitions" require "active_record/connection_adapters/sqlite3/schema_dumper" require "active_record/connection_adapters/sqlite3/schema_statements" gem "sqlite3", "~> 1.3.6" require "sqlite3"

投稿2019/03/18 06:25

perpouh

総合スコア299

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問