问题描述
我在我的应用上部署heroku时遇到问题。我已经给Gemfile添加了'pg'gem,甚至尝试添加诸如gem'therubyracer-heroku'之类的东西。
期间
heroku rake db:migrate
我得到这样的东西:
> heroku rake db:migrate
--trace
**调用db:migrate(first_time)
**调用环境(first_time)
**执行环境
rake中止!
请安装postgresql适配器:`gem install activerecord-postgresql-adap
ter`(pg不是bundle的一部分,将它添加到Gemfile中)
/app/.bundle/gems /ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters / abstract / connection_specification.rb:71:在`rescue in establish_conne
ction'
另一个有趣的部分是,在捆绑安装操作期间未提及heroku pg,就像忽略它一样。我也看过Gemfile.lock和pg在那里提到:
pg(0.11.0-x86-mingw32)
我不知道这是否是导致heroku忽略pg gem或什么的Windows gem问题?
任何人都可以帮忙或者有类似的问题吗?
//编辑
似乎相关:在此处输入链接描述 并且看起来难以解决 postgres to your production group; 重新绑定 并提交到git(Gemfile和Gemfile.lock)并推送到Heroku 。这应该可以解决你的问题。 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 I get something like this: 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: 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 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. 这篇关于Rails和Postgres - 在部署heroku时忽略pg gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
group:production do
gempg
end
bundle - 没有生产
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'
pg (0.11.0-x86-mingw32)
group :production do
gem "pg"
end
bundle --without production