2012-05-04 12 views
23

Tôi đang theo dõi this tutorial, nhưng nó không thành công khi tôi cố gắng đẩy Heroku. Có vẻ như "sqlite3.h" bị thiếu. Tôi mới phát triển nên tôi không chắc thông tin nào sẽ giúp mọi người chẩn đoán vấn đề, vì vậy, đây là tất cả mọi thứ :). Tôi đang chạy trên Mac OS X 10.7 Lion. Sau đây là các phiên bản của tất cả mọi thứ tôi đang làm việc với:"sqlite3.h" bị thiếu khi đẩy ứng dụng Rails tới Heroku

Amits-MacBook-Air-2:demo_app amitgupta$ ruby -v 
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] 
Amits-MacBook-Air-2:demo_app amitgupta$ rails -v 
Rails 3.2.3 
Amits-MacBook-Air-2:demo_app amitgupta$ sqlite3 -version 
3.7.11 2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669 
Amits-MacBook-Air-2:demo_app amitgupta$ heroku -v 
2.25.0 
Amits-MacBook-Air-2:demo_app amitgupta$ port -v 
MacPorts 2.0.4 
Entering interactive mode... ("help" for help, "quit" to quit) 
[RailsApps/demo_app] > quit 
Goodbye 

Khi tôi cố gắng đẩy để Heroku:

Amits-MacBook-Air-2:demo_app amitgupta$ heroku create --stack cedar 
Creating floating-stream-8009... done, stack is cedar 
http://floating-stream-8009.herokuapp.com/ | [email protected]:floating-stream-8009.git 
Amits-MacBook-Air-2:demo_app amitgupta$ git push heroku master 

Đây là những gì tôi nhận được:

Counting objects: 119, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (104/104), done. 
Writing objects: 100% (119/119), 33.74 KiB, done. 
Total 119 (delta 17), reused 0 (delta 0) 

-----> Heroku receiving push 
-----> Ruby/Rails app detected 
-----> Installing dependencies using Bundler version 1.1.2 
     Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment 
     Fetching gem metadata from https://rubygems.org/....... 
     Installing rake (0.9.2.2) 
     . 
     . 
     . 
     Installing sqlite3 (1.3.6) with native extensions 
     Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 
     /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 
     . 
     . 
     . 
     --disable-local 
     Gem files will remain installed in /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection. 
     Results logged to /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out 
     An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue. 
     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]:blazing-mountain-3659.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:blazing-mountain-3659.git' 

Khi tôi làm:

Amits-MacBook-Air-2:demo_app amitgupta$ sudo port install sqlite3 +universal 

Tôi nhận được:

Password: 
---> Computing dependencies for sqlite3 
---> Cleaning sqlite3 

Tiếp theo, tôi đã cố gắng:

Amits-MacBook-Air-2:demo_app amitgupta$ sudo gem install sqlite3 -v '1.3.6' 

Và nhận được:

Building native extensions. This could take a while... 
Successfully installed sqlite3-1.3.6 
1 gem installed 
Installing ri documentation for sqlite3-1.3.6... 
Installing RDoc documentation for sqlite3-1.3.6... 

Sau đó:

Amits-MacBook-Air-2:demo_app amitgupta$ bundle install 

cho:

Using rake (0.9.2.2) 
. 
. 
. 
Using sqlite3 (1.3.6) 
Using uglifier (1.2.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 

Sau đó, tôi thử đẩy lại Heroku, nhưng nhận được cùng một vấn đề. Có lẽ nó có cái gì đó để làm với sự khác biệt giữa lệnh đầu tiên "Tạo floating-stream-8009" và lệnh thứ hai "không đẩy một số refs để '[email protected]: blazing-mountain-3659.git'"?

Trả lời

25

Heroku sử dụng postgresql để bạn muốn loại bỏ sqlite3 hoặc di chuyển nó vào nhóm phát triển trong Gemfile của bạn.

Kiểm tra Gemfile.lock cho bất kỳ loại đá quý nào khác có thể có phụ thuộc vào sqlite3, vì điều này cũng có thể gây ra sự cố.

+0

Cảm ơn, hiện đang hoạt động! –

+1

Khi bạn loại bỏ sqlite3 khỏi gemfile, và lưu tệp gem, và kiểm tra gemfile.lock và xác nhận không có tham chiếu nào khác đến nó - THÌ - các bước tiếp theo là gì? Tôi vẫn đang cố gắng tìm Heroku và gặp lỗi tương tự - nhưng tôi cảm thấy không nên tìm kiếm sqlite3 ngay bây giờ. – stopshinal

+3

@stopshinal không quên cam kết các thay đổi trong tệp gem một lần nữa cục bộ trước khi đẩy nó lại vào heroku –

4

Tôi đã có một vấn đề tương tự và tôi thậm chí còn không sử dụng sqlite3 cho bất cứ điều gì nhưng sau khi loại bỏ nó từ tập tin đá quý tôi vẫn nhận rằng lỗi

gì giải quyết nó đối với tôi là một lệnh cam kết

git commit -am 

mà tôi tìm thấy trên this tutorial

53
gem 'sqlite3', :group => [:development, :test] 
group :production do 
    gem 'pg' 
end 
  1. chỉnh sửa Gemfile như trên
  2. loại bỏ Gemfile.lock
  3. chạy bundle install --without production
  4. git add .
  5. git commit -am "bundle updating sqlite3"
  6. git push heroku master
+4

Thanx! Đây là giải pháp cho tôi. – Martin

+3

Bí quyết là nhờ – Aspen

+3

Cảm ơn bạn. Nó cố định vấn đề của tôi mặc dù nó không được chọn bởi OP. – newguy

1

gì xảy ra với tôi là, tôi đã theo cùng hướng dẫn Heroku và khi tôi sử dụng git push heroku master nó đã được đẩy từ cam kết Git mới nhất của tôi (hiển nhiên!)

Điều tôi quên là trong mắt của Git, tôi vẫn đang sử dụng sqlite trong gemfile! Tôi ngớ ngẩn quá!

Vì vậy, tôi đã sử dụng git add . theo sau là git commit -m "Changed to Postgres." để Git biết về những thay đổi này. Đẩy sau đó làm việc tốt cho tôi.