我正在尝试将rails应用程序部署到heroku,但不断收到以下错误。我曾经想过,管理postgres宝石将是heroku将要处理的事情。
我已经尝试了一切我能想到的在我本地机器上安装postgres的一切,如果我想安装postgres gem,我需要这样做。还有没有名为activerecord-postgresql-adapter
的宝石...我猜这是轨道附带的标准适配器?
有关如何解决这个问题的想法吗?
App failed to start
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load -- pg) (RuntimeError)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:438:in `initialize_database'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:141:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /disk1/home/slugs/135415_c7f31f0_9f1f/mnt/config/environment.rb:9
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
... 14 levels...
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
from /home/heroku_rack/heroku.ru:1:in `new'
from /home/heroku_rack/heroku.ru:1
答案 0 :(得分:7)
Upgrade your Gemfile to Bundler 0.9并添加pg
宝石。很简单。
答案 1 :(得分:1)
事实证明这是一个错误,因为在heroku和我的机器上运行的bundler
版本不同。我已经切换到使用.gems
依赖文件,一切似乎都在运行。
答案 2 :(得分:1)
有关Heroku捆绑支持的详细信息,请访问:http://docs.heroku.com/bundler
Heroku要求您指定'pg'gem。
答案 3 :(得分:0)
哇我现在已经做了同样的事情太久了..
我意识到我使用的是宝石'ps'而不是'pg'
<强>&GT;。&LT; 强>
愚蠢的postres gem!