30 de abr. de 2016

This weekend I was learning a little more of ruby on rails, so I follow a tutorial to build a SaaS application using Postgres and I'm using Ubuntu 14.04.

When ran bundle install of application happened the error when was installing the gem pg :


Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    /home/dalton/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160430-4906-12tw4sh.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
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=/home/dalton/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/lib
extconf failed, exit code 1
Gem files will remain installed in /home/dalton/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/pg-0.18.4 for inspection.
Results logged to /home/dalton/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/pg-0.18.4/gem_make.out
Using sass 3.4.22
Using tilt 2.0.2
Using spring 1.7.1
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.0
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using sprockets 3.6.0
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.


The solution was, open terminal and install:

sudo apt-get install libpq-dev

I'm grateful to http://stackoverflow.com/questions/30162572/error-message-make-sure-that-gem-install-pg-v-0-18-1-succeeds-before-bundl where i found the solution. I suggest you enter and mark like useful the answer of @Mihai-Andrei Dinculescu

After this I run bundle install and worked fine!

Bundle complete! 12 Gemfile dependencies, 55 gems now installed.
Gems in the group production were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Nenhum comentário:

Postar um comentário