启动 rails3.1 应用程序时的 Heroku 错误缺少 postgres gem [英] Heroku error when launch rails3.1 app missing postgres gem

查看:19
本文介绍了启动 rails3.1 应用程序时的 Heroku 错误缺少 postgres gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署到 heroku.

I am trying to deploy to heroku.

Rails 3.1.0.rc4,

Rails 3.1.0.rc4,

我从 Heroku 日志中收到以下错误:

I get the following error from Heroku logs:

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 但后来出现此错误:

I tried to install the activerecord-postgresql-adapter but then I get this error:

Could not find gem 'activerecord-postgresql-adapter (>= 0)' in any of the gem sources listed in your Gemfile.

所以我尝试将其添加到我的 gem 文件中

So I tried to add this to my gem file

宝石'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)

有什么想法吗?

推荐答案

您是否安装了 PostgreSQL在你的电脑?如果你不那么先安装它,然后安装 pg gem.

Do you have PostgreSQL installed on your computer? If you don't then install it first, then install the pg gem.

# gemfile
group :production do
  gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too
  gem 'pg'
end

这篇关于启动 rails3.1 应用程序时的 Heroku 错误缺少 postgres gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆