当git推送heroku master时出错了

时间:2015-11-20 10:18:18

标签: ruby-on-rails git heroku

当我“git push heroku master” 返回一些这样的信息:

remote:        Make sure that `gem install sqlite3 -v '1.3.11'` 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
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to serene-fjord-6086.
remote: 
To https://git.heroku.com/serene-fjord-6086.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-fjord-6086.git'

但我已经成功安装了sqlite3 -v'1.3.11'

Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.11
1 gem installed

这是Gemfile,我尝试在“group:development,:test”中添加“gem sqlite3”,但它不起作用:

source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

group :production do
  gem 'pg','0.17.1'
  gem 'rails_12factor','0.0.2'
end

为什么????????

3 个答案:

答案 0 :(得分:2)

Heroku使用PG作为数据库系统,它不支持sqlite db。你应该把你的gemfile中的sqlite gem移到测试,像这样的开发组,

source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'byebug'
  gem 'sqlite3'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

group :production do
  gem 'pg','0.17.1'
  gem 'rails_12factor','0.0.2'
end

答案 1 :(得分:0)

Heroku 不支持支持sqlite。它只允许postgree

将sqlite替换为Postgree。请按照此操作link

答案 2 :(得分:0)

Heroku以前没有这个问题,我认为之前曾经忽略过sqlite gem。我几天前推着面对它。

理想的解决方案是将所有'heroku不支持的宝石'放入其中:开发和放大:Gemfile

中的测试组
group :development, :test do
    gem 'sqlite'
end

并保留你的heroku宝石:生产小组

group :production do
    gem 'rails_12factor'
    gem 'pg'
    #anything else
end