Faz dias que estou com esse problema e pesquisei de tudo mas não consigo resolver. Achei que o problema no início fosse a Gemfile ou outros arquivos estarem privados, então fiz sudo chmod 777 nela, além das outras tentativas abaixo:
No início estava faltando a 'libpq-fe.h e fiz:
brew install libpqxx
Depois rodei isso e o bundle install parecia ter funcionado, mas ainda dá erro no push master no Heroku.
Brunas-MacBook-Pro:website ramona$ sudo gem install -n /usr/local/bin gem pg
Password:
ERROR: Could not find a valid gem 'gem' (>= 0) in any repository
ERROR: Possible alternatives: gem
Building native extensions. This could take a while...
Successfully installed pg-1.1.4
Parsing documentation for pg-1.1.4
Installing ri documentation for pg-1.1.4
Done installing documentation for pg after 1 seconds
1 gem installed
E ainda ao tentar instalar a gem:
Brunas-MacBook-Pro:website ramona$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/ramona/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.4/.gemtest
Brunas-MacBook-Pro:website ramona$ sudo chmod 777 /Users/ramona/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.4/.gemtest
Password:
Brunas-MacBook-Pro:website ramona$ gem install pg
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ apply2files - /Users/ramona/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.4/.gemtest
Desinstalei e reinstalei o PostgreSQL mas o problema continua depois.
Brunas-MacBook-Pro:website ramona$ brew uninstall postgresql
Error: Refusing to uninstall /usr/local/Cellar/postgresql/11.2_1
because it is required by libpqxx, which is currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies postgresql
Brunas-MacBook-Pro:website ramona$ brew uninstall --ignore-dependencies postgresql
Uninstalling /usr/local/Cellar/postgresql/11.2_1... (3,186 files, 35.3MB)
Brunas-MacBook-Pro:website ramona$ brew update
Already up-to-date.
Brunas-MacBook-Pro:website ramona$
Brunas-MacBook-Pro:website ramona$
Brunas-MacBook-Pro:website ramona$ brew install postgresql
...
==> Summary
/usr/local/Cellar/postgresql/11.2_1: 3,186 files, 35.3MB
O que aparece quando dou push master:
Brunas-MacBook-Pro:website ramona$ git push heroku master
Enumerating objects: 135, done.
Counting objects: 100% (135/135), done.
Delta compression using up to 4 threads
Compressing objects: 100% (122/122), done.
Writing objects: 100% (135/135), 31.85 KiB | 931.00 KiB/s, done.
Total 135 (delta 9), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.1
remote: -----> Installing dependencies using bundler 2.0.1
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The dependencies in your gemfile changed
remote:
remote: You have added to the Gemfile:
remote: * pg (>= 1.1.4, ~> 1.1)
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to metalisthelaw.
remote:
To https://git.heroku.com/metalisthelaw.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/metalisthelaw.git'
Brunas-MacBook-Pro:website ramona$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
no changes added to commit (use "git add" and/or "git commit -a")
Brunas-MacBook-Pro:website ramona$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/ramona/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.4/.gemtest