2011-11-01 35 views
25

tôi chạy lệnhHeroku - không thể chạy git push Heroku chủ

heroku create --stack cedar 
git push heroku master 

nhưng nó đã cho tôi một lỗi:

> Counting objects: 144, done. Delta compression using up to 2 threads. 
> Compressing objects: 100% (128/128), done. Writing objects: 100% 
> (144/144), 50.16 KiB, done. Total 144 (delta 23), reused 0 (delta 0) 
> 
> -----> Heroku receiving push 
> -----> Ruby/Rails app detected 
> -----> Installing dependencies using Bundler version 1.1.rc 
>  Running: bundle install --without development:test --path vendor/bundle --deployment 
>  Fetching gem metadata from http://rubygems.org/....... 
>  Installing rake (0.9.2.2) 
>  Installing multi_json (1.0.3) 
>  Installing activesupport (3.1.1) 
>  Installing builder (3.0.0) 
>  Installing i18n (0.6.0) 
>  Installing activemodel (3.1.1) 
>  Installing erubis (2.7.0) 
>  Installing rack (1.3.5) 
>  Installing rack-cache (1.1) 
>  Installing rack-mount (0.8.3) 
>  Installing rack-test (0.6.1) 
>  Installing hike (1.2.1) 
>  Installing tilt (1.3.3) 
>  Installing sprockets (2.0.3) 
>  Installing actionpack (3.1.1) 
>  Installing mime-types (1.17.2) 
>  Installing polyglot (0.3.2) 
>  Installing treetop (1.4.10) 
>  Installing mail (2.3.0) 
>  Installing actionmailer (3.1.1) 
>  Installing arel (2.2.1) 
>  Installing tzinfo (0.3.30) 
>  Installing activerecord (3.1.1) 
>  Installing activeresource (3.1.1) 
>  Installing coffee-script-source (1.1.2) 
>  Installing execjs (1.2.9) 
>  Installing coffee-script (2.2.0) 
>  Installing rack-ssl (1.3.2) 
>  Installing json (1.6.1) with native extensions 
>  Installing rdoc (3.11) 
>  Installing thor (0.14.6) 
>  Installing railties (3.1.1) 
>  Installing coffee-rails (3.1.1) 
>  Installing jquery-rails (1.0.16) 
>  Installing pg (0.11.0) with native extensions 
>  Using bundler (1.1.rc) 
>  Installing rails (3.1.1) 
>  Installing sass (3.1.10) 
>  Installing sass-rails (3.1.4) 
>  **Installing sqlite3 (1.3.4) with native extensions Unfortunately, a fatal error has occurred. Please report this error to 
> the Bundler issue tracker at 
> https://github.com/carlhuda/bundler/issues so that we can fix it. 
> Thanks!** 
>  /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native 
> extension. (Gem::Installer::ExtensionBuildError) 
>  /usr/local/bin/ruby extconf.rb 
>  checking for sqlite3.h... no 
>  sqlite3.h is missing. Try 'port install sqlite3 +universal' 
>  or 'yum install sqlite3-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_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.4 
> for inspection. 
>  Results logged to /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out 
>  from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions' 
>  from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each' 
>  from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions' 
>  from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:90:in 
> `block in install' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:78:in 
> `preserve_paths' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:89:in 
> `install' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in 
> `block in install_gem_from_spec' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:93:in 
> `with_build_args' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:72:in 
> `install_gem_from_spec' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:56:in 
> `block in run' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in 
> `run' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:in 
> `install' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in 
> `install' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in 
> `run' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in 
> `dispatch' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:in 
> `start' 
>  from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/bin/bundle:13:in 
> `<top (required)>' 
>  from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `load' 
>  from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `<main>' ! !  Failed to install gems via Bundler. ! !  Heroku push rejected, 
> failed to compile Ruby/rails app 
> 
> To [email protected]:falling-ice-5948.git ! [remote rejected] master -> 
> master (pre-receive hook declined) error: failed to push some refs to 
> '[email protected]:falling-ice-5948.git' 

EDIT - bài này có thể được thực sự hữu ích: sqlite3-ruby install error

Trả lời

59

Thêm số này vào Gemfile của bạn,

group :production do 
    gem 'pg' 
end 
group :development, :test do 
    gem 'sqlite3' 
end 

sau đó thực hiện bundle rồi gửi lại cho heroku. Bạn không thể sử dụng sqlite3 trên Heroku - đó là nguyên nhân của lỗi.

+0

Cảm ơn, nhưng tôi vẫn gặp vấn đề tương tự. Ứng dụng của tôi không hoạt động khi trong tệp config/application.rb là config.assets..enabled = true, khi tôi thay đổi nó thành false nó hoạt động, nhưng không sử dụng tệp .css của tôi.Tôi nên làm gì ? Có lẽ exis mảng đặc biệt khi tôi phải thêm các tập tin css của tôi? – ruhungry

+0

Điều này cũng không giải quyết được vấn đề của tôi. – Mike

+1

Câu trả lời của tôi là giải pháp cho lỗi được đăng trong câu hỏi áp phích ban đầu liên quan đến sqlite3 không cài đặt được. Các vấn đề khác cần được mở ra như những câu hỏi mới. –

41

Nếu bạn vẫn gặp sự cố sau khi xóa sqlite3 khỏi Gemfile (hoặc chỉ phát triển) là bạn chưa cập nhật tệp trong mắt của Heroku vì nó dựa trên Git.

Rất đơn giản:

git add Gemfile 
git commit -m "Removed sqlite3 from Gemfile" 
git push heroku master 

Tôi đánh đập đầu tôi chống lại điều này trong một thời gian trước khi nhận ra rằng những thay đổi không được "dùng" bởi vì tôi đã không thực sự cam kết họ Heroku.

+0

+1 - Tôi đã bashed đầu của tôi quá cho cùng một vấn đề – Nobita

+1

+1 để làm cho cuộc sống của tôi ít đau khổ hơn –

+0

Phải làm git thêm Gemfile.lock khi tôi đã xóa phụ thuộc quá, nhưng điều này làm việc cho tôi. Cảm ơn –

13

Đây là những gì đã hiệu quả đối với tôi sau một ngày cố gắng sửa mọi quy định trong nhiều diễn đàn! Trước hết, nếu bạn đang sử dụng sách Hướng dẫn Rails hoặc trực tuyến, bạn cần chuyển sang phiên bản thứ hai (có phiên bản beta trực tuyến tại http://ruby.railstutorial.org/).

Mở soạn thảo của bạn và thêm vào các dòng để Gemfile của bạn:

group :production do  
    gem 'pg', '0.12.2' 
end 
group :development do 
    gem 'sqlite3', '1.3.4' 
end 

Bây giờ bạn cũng cần phải cam kết sửa Gemfile mới của bạn để Heroku vì vậy các bước tiếp theo là theo thứ tự.

git add Gemfile 
git commit -m "Put Sqlite3 into development in the Gemfile" 
git push heroku master 
+0

rất hữu ích cảm ơn rất nhiều tôi đã quên làm một cam kết git –

+0

Cảm ơn vì điều này. – Das

4

Nếu nó vẫn không làm việc cho bạn sau khi áp dụng tibbon và hướng dẫn animuson của (xảy ra với tôi), hãy thử bình luận ra khỏi "viên ngọc 'sqlite3" dòng trong Gemfile, sau đó thêm cam kết đẩy một lần nữa.

+0

để giải thích một chút ... bạn không muốn có bất kỳ "xung đột" nào trong gemfile của mình, tức là xóa hoặc nhận xét "gem" ban đầu "gem" ở đầu gemfile của bạn (được chèn khi tạo ứng dụng ban đầu của bạn)/giàn giáo). Dòng 'gem sqlite3' này xung đột hoặc ghi đè câu lệnh điều kiện trong câu trả lời ở trên. Và, nếu đó không phải là một vấn đề, bạn sẽ có phiên bản xung đột với 'gem sqlite3' so với' gem 'sqlite3', '1.3.4'' –

0

Tôi đã làm theo các hướng dẫn này, nhưng trong trường hợp của tôi, tôi phải thêm tệp Gemfile.lock đã cập nhật vào kiểm soát phiên bản. Vì vậy, tôi đã sử dụng cờ -a cho "tất cả" để thêm cả tệp Gemfile và tệp Gemfile.lock.

git commit -am "Put Sqlite3 into development in the Gemfile and added the updated Gemfile.lock"
git push heroku master

0

Có một cú pháp hơi khác nhau mà bạn có thể sử dụng để giải quyết vấn đề này:

gem 'pg', group: :production 
gem 'sqlite3', group: :development 
0

Nếu bạn có một tham chiếu đến:

# Use sqlite3 as the database for Active Record gem 'sqlite3'

trong Gemfile của bạn, hãy chắc chắn để nhận xét điều này hoặc thay thế bằng mã được đề xuất ở trên. Nếu không, nếu điều này vẫn còn, bạn vẫn sẽ chạy vào cùng một lỗi.

Các vấn đề liên quan