【问题标题】:Rubymine pg install errorRubymine pg 安装错误
【发布时间】:2016-10-18 16:07:14
【问题描述】:

我一直在为一个小型 Rails 项目尝试 Rubymine,并且非常希望调试能够正常工作。 该项目是一个 Rails API,并使用在我的 Mac 上运行的 Postgres 和 El Capitan。 我遇到的问题是 Rubymine 抱怨 'No Rails found in SDK'

我认为解决方案是从 Rubymine 菜单运行 bundle install。 然而,在安装 pg 时始终失败:

....
Using hashie 3.4.3
Using multi_json 1.11.2
Using multi_xml 0.5.5
Using newrelic_rpm 3.14.2.312    
Installing pg 0.18.4 with native extensions


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.


    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160617-92261-aw26bh.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib

extconf failed, exit code 1

...
Using faraday 0.9.2
Using hashie-forbidden_attributes 0.1.1
Using httparty 0.13.7
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

我已经尝试了许多其他关于堆栈溢出的解决方案,包括: Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources An error occurred while installing pg (0.17.1), and Bundler cannot continue

并使用该应用程序和 brew 在我的机器上安装了 postgres(我认为)。

任何关于制作这项工作的想法都将不胜感激!

【问题讨论】:

  • 如果你能把整个输出贴出来(最好格式化成代码,见formatting),你会省去很多猜测。
  • 你试过安装railsintaller吗?这就是我所做的,它在红宝石上效果很好
  • @grochmal 好点,我已经添加了其余的相关输出,只是没有安装所有其他 gem 的列表等
  • @Marv-C 听起来不错,但它不支持 osx el capitan,可能应该提到我也在运行它!
  • 您真正需要的只是 postgres 标头(和库),您的操作系统需要 postgresql-dev 包。

标签: ruby-on-rails ruby postgresql rubymine pg


【解决方案1】:

我认为该错误与 RubyMine 无关;我认为这与系统有关。

也就是说,如果你在命令行上执行gem install pg,我怀疑你会得到同样的错误。

我使用rvm,它可以正常工作。它安装必要的系统库。 (也就是说,其他人有时会遇到困难。)

如果您对使用 rvm 感兴趣,请谷歌“安装 rvm”以获取安装说明的链接。

也就是说,您应该确保为您的项目配置了 RubyMine,以使用您在命令行上使用的相同 Ruby。这样,您将在两种环境中获得一致的结果。

还有。仅供参考,您可以发送电子邮件至support@jetbrains.com 询问 RubyMine 问题。

【讨论】:

  • 这就是我的想法,但令人惊讶的是 gem install pg 在命令行上工作得很好。只有在 Rubymine bundler->install 中出现问题才会检查 rvm 谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-10-04
  • 2016-05-02
  • 2017-05-10
  • 1970-01-01
  • 2018-10-01
  • 2021-08-18
  • 2020-01-24
相关资源
最近更新 更多