运行 bundle install 时如何传递 gem 安装的参数? [英] How can I pass a parameter for gem installation when I run bundle install?
本文介绍了运行 bundle install 时如何传递 gem 安装的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将 pg gem 添加到我的 gemfile
I added the pg gem to my gemfile
gem 'pg'
当我运行 bundle install
时,我得到这个错误:
When I run bundle install
, I get this error:
Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/benhartney/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
看来我需要传入这个配置参数
It seems I need to pass in this config parameter
--with-pg-config=/path/to/pg_config
当我使用 bundle install
时如何做到这一点?
How can I do this when I use bundle install
?
推荐答案
您需要像这样设置构建配置选项:
You need to set a build config option like so:
bundle config build.pg --with-pg-config=/path/to/pg_config
更多信息可以在 bundle 配置手册页中找到
这篇关于运行 bundle install 时如何传递 gem 安装的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文