LoginSignup
15
13

More than 5 years have passed since last update.

Ruby on Rails 4.1.0, PostgreSQL 9.3.7で起きた問題とその解決法

Last updated at Posted at 2014-05-15

railsサーバが起動しない(Windows)

問題1

  1. railsサーバを起動しようとすると以下のエラーが出て止まる
$ rails s
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0
.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
C:/Ruby200/lib/ruby/gems/2.0.0/gems/tzinfo-1.1.0/lib/tzinfo/data_source.rb:199:i
n `rescue in create_default_data_source': No timezone data source could be found
. To resolve this, either install TZInfo:ata (e.g. by running `gem install tzi
nfo-data`) or specify a zoneinfo directory using `TZInfo:ataSource.set(:zonein
fo, zoneinfo_path)`. (TZInfo:ataSourceNotFound)

解決法

  1. Gemfileに以下を追加してbundle
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

問題2

  1. railsサーバを起動するとWebブラウザで以下のようなエラーが出る
fe_sendauth: no password supplied

解決法

  1. 新規のデータベースとそのユーザを作成する
createuser -U postgres -P postgreuser
新しいロールのためのパスワード:(postgreuser password)
もう一度入力してください:(postgreuser password)
パスワード:(postgres password)
createdb -U postgres -O postgreuser -E utf8 mydb1
パスワード:(postgres password)
  1. config/database.ymlを書き換える
development:
  adapter: postgresql
  encoding: utf8
  database: mydb1
  pool: 5
  username: postgreuser
  password: (postgreuser password)
  host: localhost
  port: 5432

test:
  adapter: postgresql
  encoding: utf8
  database: mydb1
  pool: 5
  username: postgreuser
  password: (postgreuser password)
  host: localhost
  port: 5432

production:
  adapter: postgresql
  encoding: utf8
  database: mydb1
  pool: 5
  username: postgreuser
  password: (postgreuser password)
  host: localhost
  port: 5432

問題3

  1. railsサーバを起動するとWebブラウザで以下のようなエラーが出る
Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development

解決法

  1. 未実行のマイグレーションファイルを実行する (RAILS_ENV=developmentでデベロップメント環境のマイグレーションを行える)
rake db:migrate

参考

WindowsでRuby, Rails, PostgreSQLをインストールしてherokuにデプロイする方法
createuser | PostgreSQL 9.3.2
createdb | PostgreSQL 9.3.2
rake db:migrate | Railsドキュメント

15
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
13