Rails 和 postgres - 在 Heroku 上部署期间忽略 pg gem

发布于 2024-12-10 12:36:24 字数 1018 浏览 0 评论 0原文

我在 heroku 上部署应用程序时遇到问题。我已将 'pg' gem 添加到 Gemfile,甚至尝试包含 gem 'therubyracer-heroku' 之类的内容。 在

heroku rake db:migrate

我得到这样的东西:

>heroku rake db:migrate
 --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'

另一个有趣的部分是,在推送到heroku pg时,在捆绑安装操作期间没有提到它,就像它被忽略一样。我还观看了 Gemfile.lock,其中提到了 pg:

pg (0.11.0-x86-mingw32)

我想知道是否是 Windows gem 问题导致 heroku 忽略 pg gem 或其他什么?

任何人都可以帮忙或有类似的问题吗?

//编辑

似乎相关:在此处输入链接描述

而且看起来无解

I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'.
during

heroku rake db:migrate

I get something like this:

>heroku rake db:migrate
 --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'

Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:

pg (0.11.0-x86-mingw32)

I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?

Can anyone help or had similar problem ?

//EDIT

Seems related: enter link description here

And looks unsolveable

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑叹一世浮沉 2024-12-17 12:36:24

在您的 Gemfile 中将 postgres 限制为您的生产组;

group :production do
  gem "pg"
end

重新捆绑

bundle --without production

并提交到 git(Gemfile 和 Gemfile.lock)并推送到 Heroku。那应该可以解决你的问题。

In your Gemfile limit postgres to your production group;

group :production do
  gem "pg"
end

rebundle

bundle --without production

and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文