我刚刚安装Rails 4.0.2并在创建新应用时,在捆绑阶段我得到:
Installing pg (0.17.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Dee/.rvm/rubies/ruby-2.0.0-p247/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.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
当我跑(以root身份)
gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
#-> gem instal pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Building native extensions. This could take a while...
Successfully installed pg-0.12.0
1 gem installed
Installing ri documentation for pg-0.12.0...
Installing RDoc documentation for pg-0.12.0...
#->
Run Code Online (Sandbox Code Playgroud)
当我运行bundle install时:
Installing pg (0.12.0) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.2-p290/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 …Run Code Online (Sandbox Code Playgroud) 我试图bundle在OSX 10.9上运行我的Rails项目.pg使用此错误进入gem 时失败:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/kyledecot/.rvm/rubies/ruby-2.0.0-p247/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... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking …Run Code Online (Sandbox Code Playgroud) 我已经看到这个问题,并尝试了我所见过的所有建议.
我有一个新的macbook,我正在寻找一个现有的应用程序.当我克隆应用程序时,它不会捆绑安装,并且没有安装Rails,即使它在其他目录中工作.
我尝试从gemfile中删除版本号并删除gemfile.lock.我尝试了捆绑更新.我在osx 10.9.4,rails 4.1.5和ruby 2.1.1上.
我得到的错误:
An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我安装了rvm.我尝试重新安装自制软件,rails和ruby.
会是什么呢?
当运行bundle install(或gem install pg)时,我得到以下错误,我已经尝试修复xcode命令行工具
/Users/josh/.rvm/rubies/ruby-2.0.0-p353/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.
Run Code Online (Sandbox Code Playgroud)
我创建了一个新的rails应用程序:rails new -d postgresql
但是,我无法安装pg gem.我之前使用brew安装了postgres,它会自动启动我的Mac.
我已经尝试了几个在这里发布的东西.我正在使用ruby 2.0.运行bundle install时,我收到错误:
Errno :: EACCES:权限被拒绝 - /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1/.gemtest
安装pg(0.17.1)时发生错误,Bundler无法继续.
gem install pg -v '0.17.1'在捆绑之前确保成功.
我尝试下载postgresapp,但是当我尝试启动它时,有一个明显的冲突b/c它说:无法启动5432端口.不确定这是否导致问题.
我也试过这个:
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-
config=/Users/david/Library/Application Support/Postgres/var-9.3/postgresql.conf
Run Code Online (Sandbox Code Playgroud)
并得到错误:无法构建gem原生扩展.
我是一个相当新的程序员,所以请在回复中尽可能详细. 谢谢!
固定:我遵循贾斯汀的建议,然后重新启动.在那之后,我重新'捆绑安装'并最终安装了pg gem!