2013-10-20 92 views
0

我想在Heroku上部署一個Ruby應用程序的ruby應用程序,並且出現錯誤。我按照tutortial並添加Postgres的我的寶石文件,但是當我嘗試「混帳推Heroku的大師,」我得到以下錯誤:Heroku/postgres錯誤

輸出**

id: treebook $ git push heroku master 
Counting objects: 297, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (271/271), done. 
Writing objects: 100% (297/297), 109.43 KiB | 0 bytes/s, done. 
Total 297 (delta 116), reused 0 (delta 0) 

-----> Ruby/Rails app detected 
-----> Using Ruby version: ruby-2.0.0 
-----> Installing dependencies using Bundler version 1.3.2 
     New app detected loading default bundler cache 
     Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
     You are trying to install in deployment mode after changing 
     your Gemfile. Run `bundle install` elsewhere and add the 
     updated Gemfile.lock to version control. 
     You have added to the Gemfile: 
     * pg 
     Bundler Output: You are trying to install in deployment mode after changing 
     your Gemfile. Run `bundle install` elsewhere and add the 
     updated Gemfile.lock to version control. 

     You have added to the Gemfile: 
     * pg 
! 
!  Failed to install gems via Bundler. 
! 

!  Push rejected, failed to compile Ruby/Rails app 

To [email protected]:aqueous-headland-9388.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:aqueous-headland-9388.git' 

它告訴我「捆綁安裝」當我做,我得到:

輸出**

... 
Using devise (3.1.1) 
Using jquery-rails (3.0.4) 
Installing pg (0.17.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /Users/tithos/.rvm/rubies/ruby-2.0.0-p247/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=/Users/tithos/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
    --with-pg 
    --without-pg 
    --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}/ 


Gem files will remain installed in /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0 for inspection. 
Results logged to /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0/ext/gem_make.out 

An error occurred while installing pg (0.17.0), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling. 

當我嘗試gem install pg -v '0.17.0'我得到:

輸出**

id: treebook $ gem install pg -v '0.17.0' 
Building native extensions. This could take a while... 
ERROR: Error installing pg: 
    ERROR: Failed to build gem native extension. 

    /Users/tithos/.rvm/rubies/ruby-2.0.0-p247/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=/Users/tithos/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
    --with-pg 
    --without-pg 
    --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}/ 

Gem files will remain installed in /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0 for inspection. 
Results logged to /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0/ext/gem_make.out 

我完全失去了。任何幫助都會很棒。

我嘗試 '釀造安裝PostgreSQL',並得到:

id: treebook $ brew install postgresql 
Warning: It appears you have MacPorts or Fink installed. 
Software installed with other package managers causes known problems for 
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. 
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar 
######################################################################## 100.0% 
==> Patching 
patching file src/pl/plpython/Makefile 
patching file contrib/uuid-ossp/uuid-ossp.c 
==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.4 --datadir=/usr/local 
checking for POSIX signal interface... yes 
checking for working memcmp... yes 
checking for tclsh... /usr/bin/tclsh 
checking for tclConfig.sh... no 
configure: error: file 'tclConfig.sh' is required for Tcl 
Error: Homebrew doesn't know what compiler versions ship with your version 
of Xcode (5.0.1). Please `brew update` and if that doesn't help, file 
an issue with the output of `brew --config`: 
    https://github.com/mxcl/homebrew/issues 

Thanks! 

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting 

These open issues may also help: 
    https://github.com/mxcl/homebrew/issues/23178 
id: treebook $ brew update 
error: The following untracked working tree files would be overwritten by merge: 
    Library/Formula/spim.rb 
Please move or remove them before you can merge. 
Aborting 
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master 
+0

你是怎麼安裝的Postgres? – alexius

回答

0

如果您已經安裝的Postgres:

嘗試:

echo "alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'" >> ~/.bash_profile 
source ~/.bash_profile 

或者:https://stackoverflow.com/a/9669523/2670516

如果不是:

的Linux:https://stackoverflow.com/a/10792110/2670516

的Mac:

brew install postgresql 
initdb /usr/local/var/postgres -E utf8 

# Add PostgreSQL to launchctl to let OS X manage the process and start when you login 
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents 
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 

echo "alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'" >> ~/.bash_profile 
source ~/.bash_profile 
pg start 
# Usage: pg {start|stop|restart|reload|status} 

源:http://createdbypete.com/articles/ruby-on-rails-development-with-mac-os-x-mountain-lion/

+0

當我嘗試brew安裝postgresql時,我得到:id:treebook $ brew install postgresql 警告:看起來您已經安裝了MacPorts或Fink。 與其他軟件包管理器一起安裝的軟件導致已知問題 Homebrew。如果公式無法構建,請卸載MacPorts/Fink並重試。 錯誤:文件存在 - /usr/local/lib/python2.7/site-packages – Tithos

+0

刪除MacPorts:http://guide.macports.org/chunked/installing.macports.uninstalling.html 或Fink。 並安裝HomeBrew:http://brew.sh/ –