Rails 和 postgres - 在 Heroku 上部署期间忽略 pg gem
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 Gemfile 中将 postgres 限制为您的生产组;
重新捆绑
并提交到 git(Gemfile 和 Gemfile.lock)并推送到 Heroku。那应该可以解决你的问题。
In your Gemfile limit postgres to your production group;
rebundle
and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.