簡體   English   中英

在Rails的Heroku上拒絕推送

[英]Push rejected on Heroku, Rails

我知道這個問題在這里發生過幾次,但我嘗試的解決方案似乎都沒有奏效。 我在將應用程序推送到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

任何技巧如何克服這一點?

Heroku不支持SQLite

您需要將其保留在您的development小組或類似小組中:

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

-

據我Gemfile.lock ,您需要確保正確設置了Gemfile.lock 最好的方法是在開發環境中運行以下命令:

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

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

您需要從gem文件中刪除sqlite3並添加以下內容。

gem 'sqlite3'

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

重要提示:您必須運行

git添加 git提交

跑步前

git push heroku主

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM