2013-10-20 74 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/ –