首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在运行bundle install时传递gem安装的参数?

如何在运行bundle install时传递gem安装的参数?
EN

Stack Overflow用户
提问于 2011-03-02 21:01:52
回答 4查看 20.1K关注 0票数 66

我将添加到了我的gemfile中

代码语言:javascript
复制
gem 'pg'

当我运行bundle install时,我得到这个错误:

代码语言:javascript
复制
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.

看起来我需要传入这个配置参数

代码语言:javascript
复制
 --with-pg-config=/path/to/pg_config

当我使用bundle install时,如何做到这一点

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2011-03-02 21:04:48

您需要设置构建配置选项,如下所示:

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/path/to/pg_config

有关更多信息,请访问bundle config man page

票数 87
EN

Stack Overflow用户

发布于 2011-03-02 21:06:47

在'bundle install‘之前运行'bundle config’来设置参数,即:

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/path/to/pg_config
bundle install
票数 15
EN

Stack Overflow用户

发布于 2011-03-02 21:34:30

使用Rails3PostgreSQL。我很喜欢这个

代码语言:javascript
复制
>rails new test_app -d postgreSQL
>cd test_app
>mkdir .bundle
>echo "BUNDLE_BUILD__PG: --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config" > .bundle/config
>bundle install

因此您可以在源代码管理中保留配置。

对于用户的配置文件

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config

这将创建~/.bundle/config文件。

票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5167829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档