Nice programing

번들 설치를 실행할 때 gem 설치를위한 매개 변수를 어떻게 전달할 수 있습니까?

nicepro 2020. 11. 24. 19:53
반응형

번들 설치를 실행할 때 gem 설치를위한 매개 변수를 어떻게 전달할 수 있습니까?


내 gemfile에 pg gem추가했습니다.

gem 'pg'

실행 bundle install하면 다음 오류가 발생합니다.

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.

이 구성 매개 변수를 전달해야하는 것 같습니다.

 --with-pg-config=/path/to/pg_config

사용할 때 어떻게 할 수 bundle install있습니까?


다음과 같이 빌드 구성 옵션을 설정해야합니다.

bundle config build.pg --with-pg-config=/path/to/pg_config

더 많은 정보는 번들 구성 매뉴얼 페이지 에서 찾을 수 있습니다 .


'번들 설치'전에 '번들 구성'을 실행하여 매개 변수를 설정하십시오.

bundle config build.pg --with-pg-config=/path/to/pg_config
bundle install

Rails3PostgreSQL을 . 나는 이것을 좋아한다

>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

소스 제어에서 구성을 유지할 수 있습니다.

사용자 프로필

bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config

~ / .bundle / config 파일이 생성됩니다.


Ruby 2.x 이상을 사용하는 경우 thrift 0.9.0을 빌드 할 수 없습니다. https://issues.apache.org/jira/browse/THRIFT-2219를 참조 하십시오 . Thrift 0.9.2가 수정되었습니다.

다음을 설치해보십시오. gem install rbhive -v 1.0.3.pre

참고 URL : https://stackoverflow.com/questions/5167829/how-can-i-pass-a-parameter-for-gem-installation-when-i-run-bundle-install

반응형