konchanxxx / menta

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

rails s でのエラー (全然先に進めなくて困ってます。泣) 初期化した方が良いのでしょうか #36

Closed RYUTAONO0929 closed 5 years ago

RYUTAONO0929 commented 5 years ago

概要

rails sでサーバーを起動しブラウザで確認しようとするとエラーが発生します。 1ページ進むたびにエラーが出るので一度すべて初期化した方が良いのでしょうか?

実現したいこと

3-3

p99

困っていること

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

9

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

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

これだけ大量にエラーが出るので先に進めない。 過去にpythonやrailsをドットインストールで練習したことがローカル環境に影響しているのかもしれない。

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

konchanxxx commented 5 years ago

過去にpythonやrailsをドットインストールで練習したことがローカル環境に影響しているのかもしれない。

あー、これは影響してそうですね。通常通りテキストを進めていたらそんなにエラーは発生しないのになぁと思っていました。 おそらくインストールする際にsudoコマンドを多用したりして権限周りとかが異常な状態になっていたりはしそうです。 ただこのエラーはそんなに関係ないっすね。エラーが出るたびに原因特定せずに初期化していたらキリがないので基本的には頑張って解消する方が良いですね。 まずはエラーメッセージをみて問題がありそうなところをググって見ましょう あとエラーメッセージはテキストで貼り付けて欲しいです。スクショだとコピれないので:cry:

RYUTAONO0929 commented 5 years ago

PG::ConnectionBad

could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

### Convenience alias for PG::Connection.new.
    def self::connect( *args )
        return PG::Connection.new( *args )
    end
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:90:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/migration.rb:554:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in `call_app'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in `block in call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/static.rb:127:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:524:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
RYUTAONO0929 commented 5 years ago

エラーメッセージはこんな感じです。 以前の学習の影響がこれ以上でないようにしたいです。

RYUTAONO0929 commented 5 years ago

一応それっぽいのは見つけたのですが、sudoコマンドを使っています。 https://askubuntu.com/questions/50621/cannot-connect-to-postgresql-on-port-5432

RYUTAONO0929 commented 5 years ago

流れを確認したいのですが、 1.今出ているエラーを修正する 2.初期化して初めからやりなおす(過去の学習の影響でエラーが頻発するため) 3.新たに出てきたエラーはその都度解決策を探す

みたいな感じでしょうか

konchanxxx commented 5 years ago

これとかでは無理ですかね? https://qiita.com/ms2sato/items/a0f7d32a3ecda76a7be3

konchanxxx commented 5 years ago

以前の学習の影響がこれ以上でないようにしたいです。

issueにしてもらったもの以外にもエラー頻発している感じでしょうか? 以前の学習の影響はあるかもしれないですが、全てがそうとは言えないので。

RYUTAONO0929 commented 5 years ago

他にも頻発してます。

konchanxxx commented 5 years ago

2.初期化して初めからやりなおす(過去の学習の影響でエラーが頻発するため)

は本当に原因不明のエラー以外はやらないで良いかと思います。

基本的にはエラーは原因や解決方法を見つけて解消するのが良いかなと思います:bow:

RYUTAONO0929 commented 5 years ago

ryutaono@DESKTOP-G6D20US:~/taskleaf$ rm /usr/local/var/postgres/postmaster.pid
rm: cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory
ryutaono@DESKTOP-G6D20US:~/taskleaf$ bin/rails s
=> Booting Puma
=> Rails 5.2.2 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.0-p0), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2019-02-23 12:37:12 +0100

PG::ConnectionBad (could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
):

vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:90:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/migration.rb:554:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in `call_app'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in `block in call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/static.rb:127:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:524:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
RYUTAONO0929 commented 5 years ago

bin/rails s出来なくなりました

RYUTAONO0929 commented 5 years ago

月曜日からしばらくPCを使えない環境になるので、それまでに完全に解決したいです。 また、時差の関係も在り、質問に即座にご回答いただけないので、これ以上エラーが頻発すると無限に時間を奪われてしまいます。 一度初期化する以外に良い案はございますでしょうか?

RYUTAONO0929 commented 5 years ago

ryutaono@DESKTOP-G6D20US:~/taskleaf$ rm /usr/local/var/postgres/postmaster.pid
rm: cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory
ryutaono@DESKTOP-G6D20US:~/taskleaf$ bin/rails s
=> Booting Puma
=> Rails 5.2.2 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.0-p0), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2019-02-23 12:37:12 +0100

PG::ConnectionBad (could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
):

vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:90:in `connection'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/migration.rb:554:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in `call_app'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in `block in call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/static.rb:127:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:524:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
konchanxxx commented 5 years ago

月曜日からしばらくPCを使えない環境になるので、それまでに完全に解決したいです。 また、時差の関係も在り、質問に即座にご回答いただけないので、これ以上エラーが頻発すると無限に時間を奪われてしまいます。 一度初期化する以外に良い案はございますでしょうか?

完全に解決っていうのはこのエラーを解決するという感じでしょうか?それとも恒久的にエラーが発生しないような状況を作るという意味合いでしょうか?

一度初期化する以外に良い案はございますでしょうか?

初期化しても良いですが次同じようにエラー発生した時はどうするつもりでしょうか?

konchanxxx commented 5 years ago

これってどういうことかとか理解おkでしょうか?(理解度の確認です。)

$ rm /usr/local/var/postgres/postmaster.pid
rm: cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory
RYUTAONO0929 commented 5 years ago

説明不足で申し訳ありません。 テキスト通りに進めていく上で恒久的にエラーが発生しないような状況を作るという意味合いです。

$ rm /usr/local/var/postgres/postmaster.pid
rm: cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory

分からないです。。。

konchanxxx commented 5 years ago
$ ps aux | grep postgres

した結果貼ってもらえますか?

RYUTAONO0929 commented 5 years ago
ryutaono@DESKTOP-G6D20US:~/taskleaf$ ps aux | grep postgres
ryutaono   920  0.0  0.0  14804  1208 tty2     S    14:11   0:00 grep --color=auto postgres
ryutaono@DESKTOP-G6D20US:~/taskleaf$
RYUTAONO0929 commented 5 years ago

こんな感じです。

konchanxxx commented 5 years ago

テキスト通りに進めていく上で恒久的にエラーが発生しないような状況を作るという意味合いです。

恒久的にはちょっと厳しいかなと思います。というのもテキストの通りに進めていてもライブラリのバージョンの問題などでエラーが発生するようなケースもありますし、作業漏れでエラーが発生するケースもあります。エンジニアの作業って単純にもの作るだけじゃなくてエラーが発生しても逃げずに対処する必要があるのでエラーがない状況は実現できないかなと思います:bow: なので一つ一つの作業の意味を理解していくことでエラー解消できるスキルを身につける必要があります。

konchanxxx commented 5 years ago

分からないです。。。

エラー解消するだけじゃなくて一つ一つの作業の意味を理解するように努めて欲しいです:bow:じゃないとスキルアップしないです。学習している目的って書籍をやり遂げることが目的じゃないですよね?エンジニアとしてのスキルを身につけることが目的だと思います。エラーを解消したりバグを見つけたりその原因を突き止めて解決する力もエンジニアに必要な能力なので現状でそこが身についていないならその力をつけていく必要があります。 今回の場合だとrm というコマンドがあるのでそれをネットで調べてみてください:bow:

konchanxxx commented 5 years ago

$ ps aux | grep postgres は psコマンドというやつですね。auxはオプションです。

ps コマンド オプション とかで調べたら出てきます。 | はパイプと呼びます。 grepgrep コマンド です。

konchanxxx commented 5 years ago

postgresのデータベースサーバが起動してなさそうっすね which pg_ctl とかしたらどうなりますかね?

RYUTAONO0929 commented 5 years ago
ryutaono@DESKTOP-G6D20US:~/taskleaf$ which pg_ctl
ryutaono@DESKTOP-G6D20US:~/taskleaf$
RYUTAONO0929 commented 5 years ago

こんな感じです

RYUTAONO0929 commented 5 years ago

rmコマンド調べました。 ファイルを削除するときに使うコマンドであることがわかりました。 エラーを自分で解決できないのは何の知識が足りないからなのでしょうか。

RYUTAONO0929 commented 5 years ago

エラーの解決方法を先に勉強してからrailsに移らないと、時間が永遠にかかってしまいます。 エラーは経験からしか克服方法を見いだせないのでしょうか。

konchanxxx commented 5 years ago

やっぱりpostgresのデータベースサーバが立ち上がってないみたいですね。 テキストの2-5-3にも記述がありました

$ sudo service postgresql start

して試してみてください:bow:

RYUTAONO0929 commented 5 years ago
ryutaono@DESKTOP-G6D20US:~/taskleaf$ sudo service postgresql start
[sudo] password for ryutaono:
 * Starting PostgreSQL 10 database server

OKみたいです

konchanxxx commented 5 years ago

エラーの解決方法を先に勉強してからrailsに移らないと、時間が永遠にかかってしまいます。

時間とはテキストを消化するためにかかる時間という意味合いですか?エンジニアの力を身につけるための時間なのであればエラー解決に費やす時間は無駄じゃない気がしますが。。

エラーは経験からしか克服方法を見いだせないのでしょうか。

基本的にはそうかなと思います。エラーやバグを経験しているとだいたい予測できるようになってきます。良い記事がありました:bow:

https://qiita.com/yogoken/items/84dc3bbeeaba0c273d2c

konchanxxx commented 5 years ago

rmコマンド調べました。 ファイルを削除するときに使うコマンドであることがわかりました。

そうですね。

cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory

の部分はどうでしょう?

エラーを自分で解決できないのは何の知識が足りないからなのでしょうか。

今回の場合だとpostgresql、コマンド、エラー出力の知識が足りていないとかかなと思います。 それぞれの知識を深めていっても良いですが、それはそれでかなり時間をかけることになるので結局はエラーが発生したら対処していく中で身につけるのが一番早いかなと思います。

konchanxxx commented 5 years ago

OKみたいです

これでbundle exec rails sしたらどうなりますかね?

RYUTAONO0929 commented 5 years ago

bin/rails db:migrateで一度変更を保存しないといけないのでしょうか?

ActiveRecord::PendingMigrationError
Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development

577 578 579 580 581 582 | # Raises <tt>ActiveRecord::PendingMigrationError</tt> error if any migrations are pending.       def check_pending!(connection = Base.connection)         raise ActiveRecord::PendingMigrationError if connection.migration_context.needs_migration?       end        def load_schema_if_pending!
-- | --
Application Trace | Framework Trace | Full Trace
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/migration.rb:579:in `check_pending!'
vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/migration.rb:556:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in `call_app'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in `block in call'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
vendor/bundle/ruby/2.5.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/rack/logger.rb:26:in `call'
vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/middleware/static.rb:127:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/engine.rb:524:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
RYUTAONO0929 commented 5 years ago

そうですね。

cannot remove '/usr/local/var/postgres/postmaster.pid': No such file or directory

の部分はどうでしょう?

--postmaster.pidというディレクトリにファイルが存在しないということでしょうか

RYUTAONO0929 commented 5 years ago
bin/rails db:migrate

したところテキストのような表示となり、解決致しました。

RYUTAONO0929 commented 5 years ago

今回のエラーはPostgreSQLを起動していなかった点が問題だったのでしょうか?

konchanxxx commented 5 years ago

@RYUTAONO0929 解決したようで良かったです:bow:

postmaster.pid はディレクトリではなくファイルですね file or directoryなのでファイルもしくはディレクトリが存在しないという意味合いです。 pidファイルがあるのかなと思って削除しようとしたがなかったためこのような出力になった感じですね。

konchanxxx commented 5 years ago

今回のエラーはPostgreSQLを起動していなかった点が問題だったのでしょうか?

そうですね。PCを再起動するなどした時にpostgresqlのサーバーが停止されるので起動してあげる必要がありそうです。自動で起動する設定にもできると思いますが、そこはちょっと調べてチャレンジしてみてください:bow: https://kazmax.zpp.jp/pgsql/pgsql2.html とか見れば良いかもです。

konchanxxx commented 5 years ago

あと追加でコメントしてもらう場合はissueをcloseしないでほしいです。ステータスで閉じてないやつはチェックしているため追えなくなります:bow:宜しくお願いします:bow: