0

これが私のエラーです。

PG::Error - could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (fe80::1) and accepting
    TCP/IP connections on port 5432?

homebrewを使用してpostgresqlを/usr/ local / bin / psqlにインストールしました。このバージョンを認識させるには、これをbashファイルに追加する必要がありました。

export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"

RailsアプリにCDを挿入してコマンドを実行すると

rails s

それは次のように始まります

=> Booting Thin
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

次に、でアプリを表示しようとするとhttp://0.0.0.0:3000、上記のエラーが発生します。これが発生する理由を誰かが知っている可能性があります。

4

1 に答える 1

0

メッセージにあるように、このエラーの最も可能性の高い原因は、実際にpostgresサーバーを実行していないことです。通常、これは* /etc/init.d/pg_ctl *を使用して起動しますが、これはbrewを介してインストールしたため、ターミナルウィンドウで次のコマンドを実行するだけです。

postgres

そして、サーバーが起動するはずです。起動時に自動的に起動するように設定されていない場合は、マシンを再起動した後、毎回そのコマンドを実行する必要があります。

于 2013-03-06T00:00:14.687 に答える