简体   繁体   English

rails 3.1.3:第一次运行 db:migrate 时 rake 中止(无法解析 YAML)(尝试在 mac lion 上本地运行 postgres)

[英]rails 3.1.3: rake aborts (couldn't parse YAML) when run first db:migrate (trying to run postgres locally on mac lion)

For a new project I'm trying to run postgres locally.对于一个新项目,我正在尝试在本地运行 postgres。

Mac Lion has Postgres installed (9.1.2). Mac Lion 安装了 Postgres (9.1.2)。 I modified my path in.bash_profile (per another SO thread) so now I have no trouble creating a database or user using the psql utility.我修改了 in.bash_profile 中的路径(根据另一个 SO 线程),所以现在我可以毫不费力地使用 psql 实用程序创建数据库或用户。

I uninstalled and re-installed the pg gem (0.13.2) using env ARCHFLAGS="-arch x86_64" gem install pg per the excellent blog at http://blog.willj.net/2011/05/31/setting-up-postgresql-for-ruby-on-rails-development-on-os-x/我使用env ARCHFLAGS="-arch x86_64" gem install pg根据http://blog.willj.net/2011/05/31/setting-up上的优秀博客卸载并重新安装了 pg gem (0.13.2) -postgresql-for-ruby-on-rails-development-on-os-x/

My Gemfile uses the pg gem for development, test, and production. My Gemfile 使用 pg gem 进行开发、测试和生产。 I've run bundle install.我已经运行了捆绑安装。

My database.yml looks like this (and the username and database names are correct and I verified I can access the database fr that username using the psql utility):我的 database.yml 看起来像这样(用户名和数据库名称是正确的,我验证了我可以使用 psql 实用程序访问该用户名的数据库):

development:
 adapter: postgresql
  encoding: unicode
  database: ddchart_development
  pool: 5
  username: ddchart
  password:

(same for test and production, except _test and _production. Password is blank, right?) (测试和生产相同,除了 _test 和 _production。密码为空,对吗?)

When I run bundle exec rake db:migrate it aborts:当我运行bundle exec rake db:migrate时,它中止了:

rake aborted!
couldn't parse YAML at line 8 column 10

Any help would be appreciated!任何帮助,将不胜感激!

If you pasted the code correctly, there are errors in the code.如果您正确粘贴代码,则代码中存在错误。 For example, there's only one space before "adapter", but two before following lines.例如,“adapter”之前只有一个空格,但在后续行之前有两个空格。

In YAML, indentation matters.在 YAML 中,缩进很重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM