Heroko problem / can't install gem pg

Hello guys,

I didn't touch ror for a while. Today i tried to upload an easy static page to heroku. I got the error: we're sorry but something went wrong. So i researched a bit and found out that i need to install the gem pg for heroku now.

But when i write it in the gemfile and run sudo bundle install i get:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/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/1.8/usr/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   --without-pg-config   --with-pg_config   --without-pg_config

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ pg-0.13.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.13.1/ext/ gem_make.out An error occured while installing pg (0.13.1), and Bundler cannot continue. Make sure that `gem install pg -v '0.13.1'` succeeds before bundling.

btw: a mkmf.log file does not exists

so i tried sudo gem install pg -v '0.13.1'

and got:

Building native extensions. This could take a while... ERROR: Error installing pg:   ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/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/1.8/usr/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   --without-pg-config   --with-pg_config   --without-pg_config

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ pg-0.13.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.13.1/ext/ gem_make.out

I also did some research to fix this problem and only found this:

PATH=$PATH:/Library/PostgreSQL/8.3/bin sudo gem install pg

and this didn't worked - no wonder i didn't install PostgreSQL.

any ideas?

best regards

Sascha

Have you installed Postgre on your computer?

If you just want to use Postgre on heroku and… lets say mysql/sqlite on your computer

then in your gemfile do this

group :development do

gem ‘sqlite3’

end

group :production do

gem ‘pg’

end

run bundle

and then start again your push to heroku (do another commit… push etc etc etc)

Javier Q

For a short while i got postgres-pr ? But its uninstalled atm. Could that be a problem for the PATH?

I tried like you said. But the problem remains, if i try bundle install i get this error message about pg. And when i try heroku push, it says:

Heroku push rejected, failed to install gems via Bundler

Well, how i said it's just a static page. Just to show some Informations. I don't need databases or anything.

Is pg really essential for heroku now?

I forgot something

bundle --without production

after that just do

git commit …

and then push

git push heroku …

and it has to work

Javier Q.

Thanks now it works!

Sad that this wasn't the reason ;( still getting: We're sorry, but something went wrong.(500)

I should have done my research better ;(

This is the wrong line:

<%= stylesheet_link_tag "application", :media => :all %>

I'm searching now for a solution :wink: before the rails update i just used <%= stylesheet_link_tag :all %> :smiley:

Thank you for your help!

Sorry little mistake the wrong line is:

<%= stylesheet_link_tag "application", :media => "all" %>

maybe you just use

<%= stylesheet_link_tag “application” %>

It will grab the application.css and if you look inside the file you’ll see a line like this

//= require_tree .

and it will use the other css files so you don’t need to keep on adding each file (or maybe add what you need)

If it shows errors… you can type “heroku logs” and see what happened

Javier Q

My problem was that heroku logs showed me no errors first- but now. I am working to solve the problems now, its bit more than the stylsheet. (Maybe I shouldn't do this at 2:43 am :D)

have a nice day! (or night)

Well here is 20:52. :slight_smile:

Javier Q.

I got to fix all problems now :slight_smile:

i had to to set config.assets.compile = true ( config/environments/ production.rb)

Thanks, you helped me a lot!

Well … its rare because as far as I know that comes already in production.rb

Anyway, I’m glad you’ve solved it :slight_smile:

Javier Q.