Heroku application does not have postgresql adapter, there will be no Rake db: migrate with Rails 3.1.3

I have a rails application that I want to run on a hero for testing. I am using rails 3.1.3 and I cannot get the rake application in the database on heroku. However, when pressed, the application works fine. When I try the hero rake db: migrate I get an error:

rake is interrupted! Install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is not supplied. In the Gemfile.)

I tried adding gem 'pg' to the gemfile. Then, when I click the application on the hero, I get an error message:

You added to the Gemfile: * pg FAILED: http://devcenter.heroku.com/articles/bundler ! Heroku push rejected, unable to set gems through the bundler

I don’t understand why it will not be installed, so I tried to install it locally to find out if there is a problem there, and it will not be installed locally either. I use RVM, and trying to install the package, I get

Gem :: Installer :: ExtensionBuildError: ERROR: Failed to create custom genre extension.

  /Users/username/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying 

anyway. If the building does not work, try again with --with-pg-config = / path / to / pg_config checking for libpq-fe.h ... no Cannot find the header libpq-fe.h * extconf.rb failed * The Makefile could not be created for some reason, the necessary libraries and / or headers may have been missing. Check the mkmf.log file for more details. You may need configuration options.

** more lines non-essential **

em files will be installed in /Users/username/.rvm/gems/ ruby-1.9.2-p180@nebular2 /gems/pg-0.13.1 for verification. Results recorded in /Users/username/.rvm/gems/ ruby-1.9.2-p180@nebular2 /gems/pg-0.13.1/ext/gem_make.out An error occurred while installing pg (0.13.1), and the Bundler cannot Continue. Make sure gem install pg -v '0.13.1' succeeds before sending in one package.

Does anyone understand what is going on? I cannot figure out how to fix this error.

+4
source share
2 answers

You need to install PostgreSQL http://www.postgresql.org/download/macosx/

Then you need to reset several paths (in the terminal):

  $ PATH=/Library/PostgreSQL/9.1/bin:$PATH 

Then just install the package.

+1
source

You do not have the required headers. You must first install libpq dev or devel (development tools depending on your system) on your system, and then try bundle install again

For example, the package for fedora is libpqxx-devel.

+1
source

Source: https://habr.com/ru/post/1396127/


All Articles