繁体   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