Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

[HELP solved] gem 'pg' - error while instalation - "Deploying to Heroku"

I cannot install gem 'pg' Could you help me why it doe not work?

Error message in terminal:

creating extconf.h
creating Makefile

make
compiling pg.c
pg.c: In function ‘Init_pg_ext’:
pg.c:384: error: ‘PQPING_OK’ undeclared (first use in this function)
pg.c:384: error: (Each undeclared identifier is reported only once
pg.c:384: error: for each function it appears in.)
pg.c:386: error: ‘PQPING_REJECT’ undeclared (first use in this function)
pg.c:388: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)
pg.c:390: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)
make: *** [pg.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-    p194/gems/pg-0.14.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.1/ext/gem_make.out
An error occured while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.

Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.8'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development do
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end


gem 'devise'
gem 'simple_form'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

3 Answers

I just got one also having to do with the PG in Gemfile, when I used the command "run rake db:migrate I get the error:

Migrating to AddUserIdToStatuses (20130210171825) == AddUserIdToStatuses: migrating ============================ -- add_column(:statuses, :user_id, :integer) rake aborted! An error has occurred, this and all later migrations canceled:

PG::Error: ERROR: relation "statuses" does not exist : ALTER TABLE "statuses" ADD COLUMN "user_id" integer

I've had problems with that migration file before, but so close to actually having this application displayed online!

Oh also Yuichi the only difference I saw from your Gemfile and mine was that the PG in mine has double quotes.

It worked when I did this:

bundle install --without production
bundle install