在Heroku,Rails上推送拒绝

时间:2016-01-03 11:42:07

标签: ruby-on-rails git heroku

我知道这个问题发生在这里几次,但我尝试过的解决方案似乎没有人工作。我在将应用程序推送到Heroku时遇到了问题。所以我输入git push heroku master并发生此错误:

remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
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 sleepy-atoll-4840.
remote: 
To https://git.heroku.com/sleepy-atoll-4840.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sleepy-atoll-4840.git'

这是我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.4'

group :development do
  gem 'sqlite3', '1.3.11'
end

gem 'sass-rails', '4.0.0.rc1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.18.1'
end

任何提示如何克服这一点?

2 个答案:

答案 0 :(得分:0)

Heroku doesn't support SQLite

您需要将其保存到development组或类似网站:

#Gemfile
gem "pg", group: :production
gem "sqlite3", group: :development

-

我已经看到你已经有了这个,你需要确保你的Gemfile.lock设置正确。执行此操作的最佳方法是在开发环境中运行以下命令:

$ bundle install --without production
$ bundle update
$ git add .
$ git commit -a -m "Gem"
$ git push heroku master

答案 1 :(得分:0)

Heroku在生产中不支持sqlite3 ......

您需要从gem文件中删除 sqlite3 并添加以下内容。

gem 'sqlite3'

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

重要提示:您必须运行

git add。 git commit

跑步前

git push heroku master

相关问题