【问题标题】:PostgreSQL installation with existing Ruby on Rails app使用现有 Ruby on Rails 应用程序安装 PostgreSQL
【发布时间】:2013-01-15 19:24:25
【问题描述】:

我在 Mac OSX lion 上,并且是 Ruby on Rails 编程的新手,所以请耐心等待。

我正在尝试开发队友的 Ruby on Rails 应用程序,但这需要我安装 PostgreSQL。我用 Postgres.app(版本 9.2.2)安装了它。但是,当我运行 rails server 时,出现以下错误。

/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib (LoadError)
  Referenced from: /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
  Reason: image not found - /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg_ext.bundle
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/pg-0.14.1/lib/pg.rb:4:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/kevin/Documents/photowhoa/config/application.rb:13:in `<top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `require'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /Users/kevin/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我已经尝试卸载并重新安装 PG gem。如果有人可以帮助我,将不胜感激。

【问题讨论】:

  • 我对 Postgres.app 一无所知,但我个人会选择 Homebrew 路线。我已经多次成功了。
  • 你确定PG gem 安装好了?看起来不像...首先确认已正确安装...我有一台具有类似设置的笔记本电脑(使用 postgres 应用程序),它工作得很好。
  • 您可能会觉得这很有帮助:stackoverflow.com/questions/9182645/…

标签: ruby-on-rails-3 gem pg


【解决方案1】:

同样的问题。 Rake 找不到 Postgres 库。 这解决了问题:

导出 DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.2/lib

调整 lib 的路径以匹配你的。

【讨论】:

    猜你喜欢
    • 2014-07-13
    • 1970-01-01
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多