为什么不安装bundle允许pg gem完全安装? [英] Why isn't bundle install allowing for the pg gem to fully install?

查看:122
本文介绍了为什么不安装bundle允许pg gem完全安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了pg gem,如图所示,但是...

 构建原生扩展。这可能需要一段时间... 
成功安装pg-0.11.0
错误:无法在任何存储库中找到有效的gem' - '(> = 0)
错误:可能在任何存储库中找不到有效的gem'-with-pg-config = / usr / local / pg / bin / pg_config'(> = 0)
1 gem installed
安装ri文档, 0.11.0 ...
为pg-0.11.0安装RDoc文档...

一些奇怪的事情发生时,我捆绑安装,它不会完全安装pg gem:

 获取http:/的源索引/rubygems.org/ 
使用rake(0.9.2)
使用abstract(1.0.0)
使用activesupport(3.0.10)
使用构建器(2.1.2)
使用i18n(0.5.0)
使用activemodel(3.0.10)
使用erubis(2.6.6)
使用rack(1.2.3)
使用rack- mount(0.6.14)
使用机架测试(0.5.7)
使用tzinfo(0.3.29)
使用actionpack(3.0.10)
使用MIME类型1.16)
Usin g polyglot(0.3.2)
使用treetop(1.4.10)
使用邮件(2.2.19)
使用actionmailer(3.0.10)
使用arel(2.0.10) )
使用activerecord(3.0.10)
使用activeresource(3.0.10)
使用annotate(2.4.0)
使用bundler(1.0.18)
使用diff-lcs(1.1.2)
使用factory_girl(1.3.3)
使用rdoc(3.9.3)
使用thor(0.14.6)
使用railties(3.0。 10)
使用rails(3.0.10)
使用factory_girl_rails(1.0)
使用faker(0.3.1)
使用gravatar_image_tag(1.0.0.pre2)
使用nokogiri(1.5.0)
使用本机扩展安装pg(0.11.0)/Users/******/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/ 1.9.1 / ruby​​gems / installer.rb:552:在`在build_extensions的block中救援:'错误:无法构建gem本机扩展。 (Gem :: Installer :: ExtensionBuildError)

然后我得到一些线条,告诉我可能缺少必要的库或头文件:

  *** extconf.rb失败*** 
由于某些原因无法创建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 / TonyNg / .rvm / rubies / ruby​​-1.9.2-p180 / bin / ruby​​
--with-pg
- -without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include = $ {pg-dir} / include
--with-pg-lib
--without-pg-lib = $ {pg-dir} / lib $ b $ --with-pg-config
extconf.rb:24:在``中:没有这样的文件或目录 - / users / **** /

这是我的宝石档:

  source'http://rubygems.org'

gem'rails','3.0.10'

#Bundle edge Rails改为:
#gem'rails',::git => 'git://github.com/rails/rails.git'

gem'pg'
gem'gravatar_image_tag','1.0.0.pre2'
gem'will_paginate ','3.0.pre2'



group:development do
gem'rspec-rails','2.6.1'
gem'annotate ','2.4.0'
gem'faker','0.3.1'
end

group:test do
gem'rspec-rails',' 2.6.1'
gem'webrat','0.7.1'
gem'spork','0.9.0.rc8'
gem'factory_girl_rails','1.0'
end

#使用独角兽作为web服务器
#gem'unicorn'

#使用Capistrano部署
#gem'capistrano'

#使用调试器(ruby-debug for Ruby 1.8.7+,ruby-debug19 for Ruby 1.9.2+)
#gem'ruby-debug'
#gem'ruby-debug19 ',:require => 'ruby-debug'

#捆绑额外的宝石:
#gem'bj'
#gem'nokogiri'
#gem'sqlite3-ruby',: require => 'sqlite3'
#gem'aws-s3',:require => 'aws / s3'

#为本地环境捆绑宝石。请确保
#在此组中放置仅测试宝石,以便它们的生成器
#和rake任务可用于开发模式:
#group:development,:test do
# gem'webrat'
#end

我该如何解决这个问题?



编辑
答案:诀窍是将pg gem安装在正确的到pg_config的路径,而在它未完全安装之前。我运行'gem install pg - --with-pg-config = / opt / local / lib / postgresql84 / bin / pg_config'作为我在最后评论中放下的路径。我只需要找到我的pg_config文件并在其下运行gem install。

解决方案

窍门是安装pg gem正确的路径到pg_config,而不是完全安装。
找到pg_config exec文件后,运行 gem install pg - --with-pg-config = / opt / local / lib / postgresql84 / bin / pg_config 。我只需找到我的pg_config文件并在该路径下运行gem install。


I've installed the pg gem as shown, but...

Building native extensions.  This could take a while...
    Successfully installed pg-0.11.0
    ERROR:  Could not find a valid gem '—' (>= 0) in any repository
    ERROR:  Could not find a valid gem '–with-pg-config=/usr/local/pg/bin/pg_config' (>= 0) in any repository
    1 gem installed
    Installing ri documentation for pg-0.11.0...
    Installing RDoc documentation for pg-0.11.0...

Something strange happens when I bundle install and it won't completely install the pg gem:

Fetching source index for http://rubygems.org/
Using rake (0.9.2) 
Using abstract (1.0.0) 
Using activesupport (3.0.10) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.10) 
Using erubis (2.6.6) 
Using rack (1.2.3) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.29) 
Using actionpack (3.0.10) 
Using mime-types (1.16) 
Using polyglot (0.3.2) 
Using treetop (1.4.10) 
Using mail (2.2.19) 
Using actionmailer (3.0.10) 
Using arel (2.0.10) 
Using activerecord (3.0.10) 
Using activeresource (3.0.10) 
Using annotate (2.4.0) 
Using bundler (1.0.18) 
Using diff-lcs (1.1.2) 
Using factory_girl (1.3.3) 
Using rdoc (3.9.3) 
Using thor (0.14.6) 
Using railties (3.0.10) 
Using rails (3.0.10) 
Using factory_girl_rails (1.0) 
Using faker (0.3.1) 
Using gravatar_image_tag (1.0.0.pre2) 
Using nokogiri (1.5.0) 
Installing pg (0.11.0) with native extensions /Users/******/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

Then I get the lines that tell me I may lack necessary libraries or headers:

   *** 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
    --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/TonyNg/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
    --with-pg-config
extconf.rb:24:in ``': No such file or directory - /users/****/

Here is my gem file:

  source 'http://rubygems.org'

gem 'rails', '3.0.10'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'



group :development do
  gem 'rspec-rails', '2.6.1'
  gem 'annotate', '2.4.0'
  gem 'faker', '0.3.1'
end

group :test do
  gem 'rspec-rails', '2.6.1'
  gem 'webrat', '0.7.1'
  gem 'spork', '0.9.0.rc8'
  gem 'factory_girl_rails', '1.0'
end

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

How do I solve this issue? Thanks in advance.

EDIT Answer:The trick was to install the pg gem under the correct pathway to pg_config whereas before it wasn't fully installed. I ran 'gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config ' for the path I had put down under my last comment. I just had to locate my pg_config file and run gem install under that.

解决方案

The trick was to install the pg gem under the correct pathway to pg_config whereas before it wasn't fully installed. I ran gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config after locating the pg_config exec file. I just had to locate my pg_config file and run gem install under that pathway.

这篇关于为什么不安装bundle允许pg gem完全安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆