【问题标题】:Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`请安装 postgresql 适配器:`gem install activerecord-postgresql-adapter`
【发布时间】:2013-07-24 15:29:24
【问题描述】:

我正在尝试将 rails 3.2 ruby​​ 1.9.3 应用程序部署到数字海洋。 在执行cap deploy:setupcap deploy:checkcap deploy 之后,出现以下错误:

$ gem install activerecord-postgresql-adapter
  * ←[33mexecuting "cd -- /home/deployer/apps/csd3/releases/20130724142600 && RA
ILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"←[0m
    servers: ["192.241.141.56"]
    [192.241.141.56] executing command
 ** [out :: 192.241.141.56] rake aborted! 
 ** [out :: 192.241.141.56] Please install the postgresql adapter: `gem install
activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfil
e.)

我在服务器上运行 gem install activerecord-postgresql-adapter 并完成。但是,当我进行上限部署时,我会收到相同的消息。我发现问题可能出在 database.yml 文件中,但看起来还不错。

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test: 
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  encoding: unicode
  database: chodae_database
  host: 192.241.141.56
  pool: 5
  username: chodae
  password:

还有 Gemfile:

group :development do
  gem 'quiet_assets', '1.0.2'
  gem 'sqlite3', '1.3.7'
  gem 'thin', '1.5.0'
  gem 'better_errors', '0.7.0'
  gem 'binding_of_caller', '0.7.1'
  gem 'meta_request', '0.2.2'
  gem 'wirble', '0.1.3'
  gem 'hirb', '0.7.1'
  gem 'populator3', '0.2.7'
  gem 'faker', '1.1.2'
  gem 'localtunnel'
  gem 'capistrano'
end

group :production do
  gem 'pg', '0.15.1'
  gem 'pg_search', '0.6.2'
  gem "nginx", '0.0.2'
  gem "passenger", "~> 4.0.10"
end

我该如何解决这个问题?

【问题讨论】:

  • 你试过brew install postgresql吗?
  • 我在windows开发环境下运行

标签: ruby-on-rails postgresql deployment capistrano


【解决方案1】:

首先,最佳实践是在所有环境中使用相同的数据库。
你能在服务器上运行RAILS_ENV=production bundle exec gem install pg 吗?

问题似乎是运行时资产组中没有pg gem

RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile

【讨论】:

  • RAILS_ENV=production bundle exec gem install pg 这给了我无法在服务器上找到 Gemfile
  • 问题似乎是运行时资产组中没有pg gem 什么意思?
  • 我提供了下面的字符串,您可以在其中看到RAILS_GROUPS=assets
猜你喜欢
  • 1970-01-01
  • 2014-04-15
  • 1970-01-01
  • 1970-01-01
  • 2012-03-25
  • 1970-01-01
  • 2013-06-03
  • 2013-03-06
  • 1970-01-01
相关资源
最近更新 更多