简体   繁体   English

为什么在运行“捆绑安装”时会出现无法构建 gem 原生扩展错误 pg (0.8.0)?

[英]Why do I get a Failed to build gem native extension error, pg (0.8.0), while running 'bundle install'?

pg gem is not specified in the gem file, why won't it install and why is it even installing at all if it is not in the gem file. pg gem 没有在 gem 文件中指定,为什么它不会安装,如果它不在 gem 文件中,为什么它甚至会安装。 I'm trying to use mysql.我正在尝试使用 mysql。

The strange thing is that the pg gem is not in my gemfile, so i thought it might be a dependency of another, after researching dependencies on the gem site, pg is shown not to be a dependency of other gems used.奇怪的是 pg gem 不在我的 gemfile 中,所以我认为它可能是另一个的依赖项,在研究了 gem 站点的依赖项之后,pg 显示不是使用的其他 gems 的依赖项。

Error Message:错误信息:

Installing pg (0.8.0) with native extensions c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:543:in `rescue in block in build_e
xtensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        c:/Ruby192/bin/ruby.exe extconf.rb
ERROR: can't find pg_config.
HINT: Make sure pg_config is in your PATH
*** 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

Gem files will remain installed in c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.8.0 for inspection.
Results logged to c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.8.0/ext/gem_make.out
        from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:521:in `block in build_extensions'
        from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:496:in `each'
        from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:496:in `build_extensions'
        from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:177:in `install'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/bin/bundle:13:in `<top (required)>'
        from c:/Ruby192/bin/bundle:19:in `load'
        from c:/Ruby192/bin/bundle:19:in `<main>'

and this is the gemfile:这是gemfile:

source :rubygems

gem "rails", ">= 3.0"
gem "rack"
gem "clearance", "0.9.0.rc9"
gem "haml"
gem "high_voltage"
gem "hoptoad_notifier"
gem "will_paginate"
gem "formtastic"
gem "dynamic_form"
gem "mysql"

The pg gem is used to access PostgreSQL databases from ruby. pg gem 用于从 ruby 访问 PostgreSQL 数据库。 Check your Gemfile.lock to find out which gem is requiring it as a dependency.检查您的 Gemfile.lock 以找出哪个 gem 需要它作为依赖项。

Please seethis Stack Overflow question if you actually need to use the pg gem.如果您确实需要使用 pg gem,请参阅此 Stack Overflow 问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行捆绑软件安装时“无法构建gem native扩展” - 'Failed to build gem native extension' when running bundle install 套件安装错误:错误:无法建立gem本机扩展 - Bundle install error : ERROR: Failed to build gem native extension 错误:无法在OSX 10.9.4上构建gem本机扩展(捆绑安装) - ERROR: Failed to build gem native extension (bundle install) on OSX 10.9.4 $ bundle install:无法构建gem原生扩展 - $ bundle install: Failed to build gem native extension PG gem 不会安装在 Rails 应用程序中:Gem::Ext::BuildError: ERROR: Failed to build gem native extension - PG gem won't install in Rails app: Gem::Ext::BuildError: ERROR: Failed to build gem native extension 安装pg gem; 错误:无法构建gem原生扩展 - Installing pg gem; ERROR: Failed to build gem native extension 捆绑安装失败,原因是:Gem::Ext::BuildError: ERROR: Failed to build gem native extension - Bundle Install failed due to : Gem::Ext::BuildError: ERROR: Failed to build gem native extension 错误:安装pg时出错:错误:无法构建gem原生扩展 - ERROR: Error installing pg: ERROR: Failed to build gem native extension 捆绑软件安装失败(错误:安装nokogiri时出错:错误:无法构建gem本机扩展) - bundle install failed (ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension) 捆绑安装:错误:无法构建gem原生扩展。 nio4r宝石 - Bundle install: ERROR: Failed to build gem native extension. nio4r gem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM