0

初めての Rails アプリケーションを VPS にデプロイしようとしています。これまでのところ、ubuntu、postgresql、node、ruby などですべて構成し、cap deploy:setupエラーなしでコマンドを実行しました。を実行しようとするとcap deploy:cold、gemfile にあるにもかかわらず、gem が見つからないため続行できないという興味深いバンドラー エラーが表示されます。私は Windows 7 で開発しているため、ユニコーンにバンドルすることはできず、この宝石を宝石ファイルのグループに入れました。

group :production do
    if RUBY_PLATFORM =~ /win32/
      gem "pg", :platform => [:mswin, :mingw]
    else
      gem "pg", :platform => :ruby
      gem 'unicorn'
    end
end

これは、実行時に得られる出力の一部ですcap deploy:cold

    ?[2;37mcommand finished in 200ms?[0m
 ** transaction: commit
  * ?[32m2013-02-06 21:11:42 executing `deploy:migrate'?[0m
  * ?[33mexecuting "cd /home/deployer/apps/blog/releases/20130206211131 && bundl
e exec rake RAILS_ENV=production  db:migrate"?[0m
    servers: ["176.58.109.176"]
    [176.58.109.176] executing command
 ** [out :: 176.58.109.176] rake aborted!
 ** [out :: 176.58.109.176] Please install the postgresql adapter: `gem install
activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfil
e.)
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.
rb:7:in `<top (required)>'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in requ
ire'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependen
cy'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection
_specification.rb:50:in `resolve_hash_connection'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection
_specification.rb:41:in `resolve_string_connection'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection
_specification.rb:25:in `spec'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection
_specification.rb:130:in `establish_connection'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/railtie.rb:82:in `block (2 levels) in <
class:Railtie>'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `instance_ev
al'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `execute_hoo
k'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:43:in `block in ru
n_load_hooks'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in `each'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in `run_load_ho
oks'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/base.rb:720:in `<top (required)>'
 ** [out :: 176.58.109.176] /home/deployer/apps/blog/shared/bundle/ruby/1.9.1/ge
ms/activerecord-3.2.11/lib/active_record/railties/databases.rake:25:in `block (2
 levels) in <top (required)>'
 ** [out :: 176.58.109.176] Tasks: TOP => db:migrate => db:load_config
 ** [out :: 176.58.109.176] (See full trace by running task with --trace)
    ?[2;37mcommand finished in 2926ms?[0m
failed: "sh -c 'cd /home/deployer/apps/blog/releases/20130206211131 && bundle ex
ec rake RAILS_ENV=production  db:migrate'" on 176.58.109.176

どんな助けも大歓迎です。しっかりとした日々を過ごした後、私はあきらめる準備ができています! 大変感謝します。

4

1 に答える 1

0

あなたのGemfile

group :production do 
  gem 'pg'
  gem 'unicorn'
end

削除し:platform => :rubyます。

EDIT:サーバー上の環境を指定してみてください:

export RAILS_ENV=production
于 2013-02-06T21:46:48.383 に答える