我正在尝试在rails应用程序上部署一个ruby到Heroku并且我得到了一个错误。我遵循了tutortial并将postgres添加到我的gem文件中但是当我尝试“git push heroku master”时出现以下错误:
输出 **
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 git@heroku.com:aqueous-headland-9388.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com: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
我完全迷失了。任何帮助都会很棒。
我尝试'brew install 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 :(得分: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}
src:http://createdbypete.com/articles/ruby-on-rails-development-with-mac-os-x-mountain-lion/