【发布时间】:2011-09-18 15:09:45
【问题描述】:
我正在尝试部署到 heroku。
Rails 3.1.0.rc4,
我从 Heroku 日志中收到以下错误:
Starting process with command: `thin -p 48902 -e production -R /home/heroku_rack/heroku.ru start`
2011-06-20T11:25:44+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (RuntimeError)
我尝试安装 activerecord-postgresql-adapter,但随后出现此错误:
Could not find gem 'activerecord-postgresql-adapter (>= 0)' in any of the gem sources listed in your Gemfile.
所以我尝试将它添加到我的 gem 文件中
宝石'pg'
产生了这个错误:
Installing pg (0.11.0) with native extensions /Users/imac/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
有什么想法吗?
【问题讨论】:
-
当我在 database.yml 中将适配器设置为 postgres 而不是 postgresql 时,我在本地看到了该错误,但由于 Heroku 在部署时重写了 database.yml,我认为这不是问题所在。您是否有机会使用 Cedar 堆栈?如果您没有在本地安装 Postgresql,那么这将解释最后一个错误,因为您需要安装它才能在本地安装 gem。
标签: ruby-on-rails-3 postgresql heroku