Ruby on rails 雷克流产了!PG::ConnectionBad:fe_sendauth:未提供密码任务:TOP=>;db:migrate(通过使用--trace运行任务查看完整跟踪)

Ruby on rails 雷克流产了!PG::ConnectionBad:fe_sendauth:未提供密码任务:TOP=>;db:migrate(通过使用--trace运行任务查看完整跟踪),ruby-on-rails,postgresql,heroku,ruby-on-rails-4,Ruby On Rails,Postgresql,Heroku,Ruby On Rails 4,我在尝试rake db时得到了以下结果:migrate rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied Tasks: TOP => db:migrate (See full trace by running task with --trace) 我在访问本地主机时也会收到类似的消息 fe_sendauth: no password supplied 我的rails服务器和rails控制台也无法工作

我在尝试rake db时得到了以下结果:migrate

rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied

Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我在访问本地主机时也会收到类似的消息

fe_sendauth: no password supplied
我的rails服务器和rails控制台也无法工作

我一直在尝试一些事情,这就是我的gemfile当前的样子:

source 'https://rubygems.org'
ruby '2.0.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'devise'


gem 'pg'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end


group :production do
  gem 'rails_12factor'
end
还有我的database.yml

development:
  adapter: postgresql
  encoding: unicode
  database: myapp_development
  pool: 5
  username: myapp
  password:

test:
  adapter: postgresql
  encoding: unicode
  database: myapp_test
  pool: 5
  username: myapp
  password:

production:
  adapter: postgresql
  encoding: unicode
  database: myapp_production
  pool: 5
  username: myapp
  password:

有什么问题?似乎要在本地访问我的postgres表,我需要某种密码?通过Heroku运行时,我的应用程序运行良好。所以我只是在做Heroku open,我可以按照我的应用程序的预期提交新的链接和帖子,但它在本地无法工作

对于您的本地计算机,在
数据库.yml中的
测试
开发
部分下,您应该将
用户名
更改为您的登录用户名。rails生成器使其与应用程序名称相同-这将不起作用。对于生产来说,这并不重要,因为它在Heroku上运行,并且在部署时会自动更改该设置。

您应该根据现有的用户名和密码设置值。您可以使用
psql-d postgres
检查您的用户,然后
\du

您是如何在本地安装postgres的?对不起,这是什么意思?对于database.yml中的本地计算机(正在测试和开发中),您应该将用户名更改为登录的用户名。rails生成器使其与应用程序名称相同-这将不起作用。对于生产来说,这并不重要,因为它是在Heroku上运行的,当您部署时,他们会自动更改该设置。谢谢Andre,这非常有帮助,并回答了我的问题。如果你把它作为一个答案,我会接受的。我的荣幸,我把它作为一个答案。