在git上运行git push heroku master之后,出现
John@JOHN-PC /g/ruby/gitdemo (master) $ git push heroku master Counting objects: 65, done. Delta compression using up to 2 threads. Compressing objects: 100% (50/50), done. Writing objects: 100% (65/65), 86.27 KiB, done. Total 65 (delta 3), reused 0 (delta 0) -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.2.0.pre Running: bundle install --without development:test --path vendor/bundle - -binstubs bin/ Fetching gem metadata from http://rubygems.org/......... Installing rake (0.9.2.2) Installing abstract (1.0.0) Installing activesupport (3.0.7) Installing builder (2.1.2) Installing i18n (0.5.0) Installing activemodel (3.0.7) Installing erubis (2.6.6) Installing rack (1.2.5) Installing rack-mount (0.6.14) Installing rack-test (0.5.7) Installing tzinfo (0.3.33) Installing actionpack (3.0.7) Installing mime-types (1.19) Installing polyglot (0.3.3) Installing treetop (1.4.10) Installing mail (2.2.19) Installing actionmailer (3.0.7) Installing arel (2.0.10) Installing activerecord (3.0.7) Installing activeresource (3.0.7) Using bundler (1.2.0.pre) Installing thor (0.14.6) Installing railties (3.0.7) Installing rails (3.0.7) Installing sqlite3 (1.3.6) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native ex tension. /usr/local/bin/ruby extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite-devel' and check your shared library search path ( the location where your sqlite3 shared library is located). *** 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=/usr/local/bin/ruby --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib --enable-local --disable-local Gem files will remain installed in /tmp/build_144lbpbfihqkv/vendor/bundle /ruby/1.9.1/gems/sqlite3-1.3.6 for inspection. Results logged to /tmp/build_144lbpbfihqkv/vendor/bundle/ruby/1.9.1/gems/ sqlite3-1.3.6/ext/sqlite3/gem_make.out An error occurred while installing sqlite3 (1.3.6), and Bundler cannot co ntinue. Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling. ! ! Failed to install gems via Bundler. ! ! Heroku push rejected, failed to compile Ruby/rails app To [email protected]:electric-waterfall-3720.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to '[email protected]:electric-waterfall-3720.git'
这个问题,搞了我一个下午,都耽误了跟老婆吃饭的时间。最后借助stackoverflow解决掉了。
http://stackoverflow.com/questions/10455527/sqlite3-h-missing-when-pushing-rails-app-to-heroku
说一下,解决方案吧:
1、找到项目的gemfile文件,打开之后,修改gem sqlite3为:
gem 'sqlite3', :group => [:development, :test]
group :production do
gem 'thin'
gem 'pg'
end
2、删除掉gemfile.lock文件
3、运行 `bundle install --without production
4、运行git add .
5、运行git commit -m "bundle updating sqlite3"
6、运行git push heroku master
OK,完美解决了。。原因,我也不知道,我就是个彩笔
John@JOHN-PC /g/ruby/gitdemo (master) $ git push heroku master Counting objects: 69, done. Delta compression using up to 2 threads. Compressing objects: 100% (54/54), done. Writing objects: 100% (69/69), 86.67 KiB, done. Total 69 (delta 6), reused 0 (delta 0) -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.2.0.pre Running: bundle install --without development:test --path vendor/bundle - -binstubs bin/ Fetching gem metadata from http://rubygems.org/......... Installing rake (0.9.2.2) Installing abstract (1.0.0) Installing activesupport (3.0.7) Installing builder (2.1.2) Installing i18n (0.5.0) Installing activemodel (3.0.7) Installing erubis (2.6.6) Installing rack (1.2.5) Installing rack-mount (0.6.14) Installing rack-test (0.5.7) Installing tzinfo (0.3.33) Installing actionpack (3.0.7) Installing mime-types (1.19) Installing polyglot (0.3.3) Installing treetop (1.4.10) Installing mail (2.2.19) Installing actionmailer (3.0.7) Installing arel (2.0.10) Installing activerecord (3.0.7) Installing activeresource (3.0.7) Using bundler (1.2.0.pre) Installing daemons (1.1.8) Installing eventmachine (0.12.10) with native extensions Installing pg (0.14.0) with native extensions Installing thor (0.14.6) Installing railties (3.0.7) Installing rails (3.0.7) Installing thin (1.4.1) with native extensions Your bundle is complete! It was installed into ./vendor/bundle Cleaning up the bundler cache. -----> Writing config/database.yml to read from DATABASE_URL -----> Rails plugin injection Injecting rails_log_stdout Injecting rails3_serve_static_assets -----> Discovering process types Procfile declares types -> (none) Default types for Ruby/Rails -> console, rake, web, worker -----> Compiled slug size is 5.5MB -----> Launching... done, v4 http://electric-waterfall-3720.herokuapp.com deployed to Heroku To [email protected]:electric-waterfall-3720.git * [new branch] master -> master