【发布时间】:2011-11-09 22:24:51
【问题描述】:
我刚刚升级到 Rails 3.1,我尝试部署到 Heroku 的第一个应用程序遇到了与 Postgres 适配器相关的问题。我可以将应用程序推送到heroku,但是当我尝试迁移数据库时,出现以下错误:
heroku rake db:迁移
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
(pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
当我尝试他们建议的安装时,我得到:
ERROR: Could not find a valid gem 'activerecord-postgresql-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-postgis-adapter, activerecord-jdbcpostgresql-adapter, activerecord-postgresql-cursors, activerecord-jdbcmysql-adapter, activerecord-jdbcmssql-adapter
这看起来已经很奇怪了......所以如果不是他们说我应该安装的东西,我应该安装什么确切的 gem 来让这个东西工作?
当我尝试安装 gem pg 时,我得到:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/jerometufte/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
...
我目前正在使用 SQLite3。非常感谢任何帮助,这让我感到困惑。
【问题讨论】:
-
如何为 Rails 和 Heroku 设置 PostgreSQL robdodson.me/blog/2012/04/27/…
标签: postgresql heroku ruby-on-rails-3.1