我尝试在工作时将我的 Rails 应用程序捆绑在我的 Mac 上。在家里它工作得很好,我之前已经自己解决了它,但这次无论我尝试什么似乎都没有解决它。
运行 bundle/bundle install 时收到的错误如下:
安装 pg (0.17.0) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/notrab/.rbenv/versions/2.0.0-p0/bin/ruby extconf.rb
检查 pg_config... 否 没有 pg_config... 无论如何都要尝试。如果构建失败,请再试一次 --with-pg-config=/path/to/pg_config 检查 libpq-fe.h... 否 Can't find the 'libpq-fe.h header * extconf.rb failed * 由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件。检查 mkmf.log 文件以获取更多详细信息。您可能需要配置选项。
提供的配置选项: --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=/Users/notrab/.rbenv/versions/2.0.0-p0/bin/ruby --with-pg --without-pg --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}/
Gem 文件将继续安装在 /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0 以供检查。
结果记录到 /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0/ext/gem_make.out
安装 pg (0.17.0) 时出错,Bundler 无法继续。
gem install pg -v '0.17.0'
在捆绑之前确保成功。
我显然试过跑步
gem install pg -v '0.17.0' 它说它成功但捆绑再次显示相同的错误。
我也试过跑步
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
文档http://postgresapp.com/documentation中对此进行了概述,但是当我尝试捆绑时会发生相同的错误。
我在兜圈子,不知道如何解决它。
我的 Gemfile 看起来像:
group :development, :test do
gem "better_errors"
gem 'meta_request'
gem 'binding_of_caller'
gem 'sqlite3'
end
group :production do
gem 'pg'
end
非常感谢,
杰米