Heroku:Sqlite3缺失

时间:2015-07-11 11:57:39

标签: ruby-on-rails postgresql heroku sqlite

我一直在努力推进Heroku,但是这个错误阻止了我进一步前进。

一开始,它说: 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 ..

1 个答案:

答案 0 :(得分:0)

我强烈建议您在本地计算机上使用postgres。如果你在sqlite3中开发并使用Heroku(postgres),你最终会遇到sqlite3会接受的问题,但postgres拒绝,因为postgres更具限制性。意味着你对数据库所做的事情在本地工作,但会在heroku上出错,从而引起很多愤怒/挫折。另外,在heroku和localhost上拥有相同的数据库是很好的。如果他们都在运行postgres,你可以推送和从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