2015-07-11 53 views
0

我一直在試圖推向Heroku,但這個錯誤阻止了我進一步前進。Heroku:Sqlite3失蹤

在開始的時候,它說: remote:Your Gemfile lists the gem sqlite3 (>= 0) more than once.

但事後:

remote:  Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.  
remote:  /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/ruby-2.0.0/bin/ruby extconf.rb 
remote:  checking for sqlite3.h... no 
remote:  sqlite3.h is missing. Try 'port install sqlite3 +universal', 
remote:  'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' 
remote:  and check your shared library search path (the 
remote:  location where your sqlite3 shared library is located). 
remote:  *** extconf.rb failed *** 
remote:  Could not create Makefile due to some reason, probably lack of necessary 
remote:  libraries and/or headers. Check the mkmf.log file for more details. You may 
remote:  need configuration options. 
remote:   
remote:  Provided configuration options: 
remote:  --with-opt-dir 
remote:  --without-opt-dir 
remote:  --with-opt-include 
remote:  --without-opt-include=${opt-dir}/include 
remote:  --with-opt-lib 
remote:  --without-opt-lib=${opt-dir}/lib 
remote:  --with-make-prog 
remote:  --without-make-prog 
remote:  --srcdir=. 
remote:  --curdir 
remote:  --ruby=/tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/ruby-2.0.0/bin/ruby 
remote:  --with-sqlite3-dir 
remote:  --without-sqlite3-dir 
remote:  --with-sqlite3-include 
remote:  --without-sqlite3-include=${sqlite3-dir}/include 
remote:  --with-sqlite3-lib 
remote:  --without-sqlite3-lib=${sqlite3-dir}/ 
remote:  Gem files will remain installed in /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection. 
remote:  Results logged to /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out 
remote:  An error occurred while installing sqlite3 (1.3.10), and Bundler cannot 
remote:  continue. 
remote:  Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling. 
remote: ! 
remote: !  Failed to install gems via Bundler. 
remote: !  
remote: !  Detected sqlite3 gem which is not supported on Heroku. 
remote: !  https://devcenter.heroku.com/articles/sqlite3 
remote: ! 
remote: 
remote: !  Push rejected, failed to compile Ruby app 

我試圖安裝的Postgres並在Gemfile中這樣做:

gem 'sqlite3', group: [:development, :test] 
gem 'pg', group: [:production] 

沒有什麼工作,我開始放棄Rails ..

+0

好哥們兒,冷靜下來..嘗試'捆綁安裝--without production'然後提交,然後更改終於推到Heroku的。讓我知道發生什麼事。 – Ojash

+2

對於它的價值,我認爲用sqlite開發然後推到PostgreSQL是一個可怕的想法。我會從本地開發的Postgres.app開始。 –

+0

@Ojash哦,我的天啊。這是工作!非常感謝!這是否意味着我每次嘗試推送時都必須「捆綁安裝 - 無需生產」? –

回答

0

我強烈建議您在本地機器上使用postgres。如果你在sqlite3中開發並使用Heroku(postgres),你最終會遇到sqlite3會接受但postgres拒絕的問題,因爲postgres更具限制性。意味着你對數據庫所做的一些工作可以在本地使用,但是會在heroku上出錯,從而導致很多憤怒/沮喪。另外,在heroku和localhost上擁有相同的數據庫是非常好的。如果它們都運行postgres,則可以將副本推送到localhost/heroku或從localhost/heroku進行復制。這樣你總是使用相同的信息。

無論如何,這裏是我的寶石文件的外觀,我相信這是默認的。

的Gemfile

source 'https://rubygems.org' 

    #gems for both development and production here 

group :development, :test do 
    #gems for only development here 
end 

group :production do 
    #gems for only production here 

end 
+0

那麼你是否建議使用PostgreSQL進行':production',':development'和':test'? –