gpt4 book ai didi

ruby-on-rails - Broken Rails setup/pg gem

转载 作者:行者123 更新时间:2023-11-29 13:01:39 25 4
gpt4 key购买 nike

呃...我在 OS X Yosemite 下破坏了我的(以前正常运行的)Rails 设置。我这样做是使用 Homebrew 来更新我的 Git 版本。在我想要的地方获得 Git 后,运行“rails c”会出现以下错误:

/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg.rb:4:in `require': dlopen(/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/lib/libpq.5.6.dylib (LoadError)
Referenced from: /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle
Reason: image not found - /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle

看到对 pg_ext 的引用,我试图验证我的 postgresql 安装。如果我尝试“gem install pg”或尝试使用 bundler 更新 gem,我会得到:

Building native extensions.  This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/Users/grogers/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

我可能让我的问题变得更糟,但我回去重新做了一个“brew install postgres”,但仍然得到同样的错误。

感谢任何帮助。谢谢!

最佳答案

您是否也通过 Homebrew 升级了 Postgresql?如果没有,您运行的是什么版本的 Postgres,如何安装它?

如果您确实升级了 Postgres,则需要为 pg gem 重建 native 绑定(bind):gem uninstall pg && gem install pg

关于ruby-on-rails - Broken Rails setup/pg gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28395363/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com