将Postgresql添加到rails app

时间:2014-08-01 19:31:50

标签: ruby-on-rails database postgresql heroku ruby-on-rails-4

我正在运行Mac OSX 10.9.4,rails 4

我正在尝试将Postgresql添加到rails应用程序以部署到heroku。但是,我似乎无法捆绑安装它。当我尝试时:

rails new myapp -d postgresql

这也行不通。我不断收到以下错误消息:

Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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.

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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  --with-pg
  --without-pg
  --with-pg-config
  --without-pg-config
  --with-pg_config
  --without-pg_config
  --with-pg-dir
  --without-pg-dir
  --with-pg-include
  --without-pg-include=${pg-dir}/include
  --with-pg-lib
  --without-pg-lib=${pg-dir}/

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_1/ppbm8m0x66x0bfm0xv3nd_300000gn/T/bundler20140801-11374-yfgvap/pg-0.17.1/gems/pg-0.17.1 for inspection.
Results logged to /var/folders/_1/ppbm8m0x66x0bfm0xv3nd_300000gn/T/bundler20140801-11374-yfgvap/pg-0.17.1/extensions/universal-darwin-13/2.0.0/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
         run  bundle exec spring binstub --all
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:352:in `resolve': Could not find gem 'pg (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:165:in `start'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:129:in `resolve'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/definition.rb:203:in `resolve'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/definition.rb:178:in `specs_for'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/definition.rb:167:in `requested_specs'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/environment.rb:18:in `requested_specs'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:13:in `setup'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler.rb:120:in `setup'
  from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/setup.rb:17:in `<top (required)>'
  from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
是的,有人可以帮助我。感谢。

0 个答案:

没有答案