【问题标题】:Sinatra/Rack/Bundler application unable to install postgres gemSinatra/Rack/Bundler 应用程序无法安装 postgres gem
【发布时间】:2014-01-13 00:42:56
【问题描述】:

我正在尝试在我的 rack/bundler 应用程序中安装 postgres gem "pg",但在尝试通过 RubyMine 安装时一直失败。

Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.5) 
Using bcrypt-ruby (3.1.2) 
Using data_objects (0.10.13) 
Using dm-core (1.2.1) 
Using dm-aggregates (1.2.0) 
Using dm-constraints (1.2.0) 
Using dm-migrations (1.2.0) 
Using fastercsv (1.5.5) 
Using json (1.8.1) 
Using json_pure (1.8.0) 
Using multi_json (1.8.2) 
Using dm-serializer (1.2.2) 
Using dm-timestamps (1.2.0) 
Using dm-transactions (1.2.0) 
Using stringex (1.5.1) 
Using uuidtools (2.1.4) 
Using dm-types (1.2.2) 
Using dm-validations (1.2.0) 
Using datamapper (1.2.0) 
Using dm-do-adapter (1.2.0) 
Installing do_postgres (0.10.13) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb 
checking for main() in -lpq... yes
checking for libpq-fe.h... no
*** 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
    --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=/Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
    --with-pgsql-server-dir
    --without-pgsql-server-dir
    --with-pgsql-server-include
    --without-pgsql-server-include=${pgsql-server-dir}/include
    --with-pgsql-server-lib
    --without-pgsql-server-lib=${pgsql-server-dir}/
    --with-pgsql-client-dir
    --without-pgsql-client-dir
    --with-pgsql-client-include
    --without-pgsql-client-include=${pgsql-client-dir}/include
    --with-pgsql-client-lib
    --without-pgsql-client-lib=${pgsql-client-dir}/
    --with-pqlib
    --without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created


Gem files will remain installed in /Users/adam419/.rvm/gems/ruby-2.0.0-p195@global/gems/do_postgres-0.10.13 for inspection.
Results logged to /Users/adam419/.rvm/gems/ruby-2.0.0-p195@global/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.13), and Bundler cannot
continue.
Make sure that `gem install do_postgres -v '0.10.13'` succeeds before bundling.

因此,出于某种原因,对于我当前的项目,如果我通过命令行安装 gem,它不会被添加到 Rubymine 的 External Libraries 文件夹中,并且到目前为止一直依赖于它自己的 bundle/gem 安装程序。因此,通过阅读其他问题,我看到下载了对 Mac os x 的 Postgres93 支持,并在命令行中尝试通过指定 pg_config 文件的路径来安装 postgres gem,它下载成功,但没有添加到Rubymine 项目中的库。

sudo gem install pg -- --with-pg config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

上述命令有效,但没有导致 gem 出现在 Rubymine 中,因此我仍然无法推送到 Heroku。因此,当尝试向捆绑安装程序提供附加参数时,我在输入时遇到语法错误

--with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

有什么办法解决这个问题吗?

【问题讨论】:

  • 现在带有参数的 sudo gem install pg 甚至不起作用。

标签: postgresql gem sinatra bundler rubymine


【解决方案1】:

解决方案 -- 用 homebrew 重新安装 Postgresql

【讨论】:

    猜你喜欢
    • 2016-05-07
    • 2011-11-10
    • 1970-01-01
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 2019-01-07
    • 2021-08-27
    • 2015-09-15
    相关资源
    最近更新 更多