Ruby on Rails未能推送到Heroku

时间:2017-05-05 02:20:05

标签: ruby-on-rails ruby git heroku

在这个问题上有很多stackoverflow帖子,但我不知道为什么我没有得到任何工作。这是我的gemfile的样子:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'sqlite3', :group => [:development, :test]
group :production do
  gem 'thin'
  gem 'pg'
end
group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

当我运行git push heroku master时,它会给我一个错误,指出gem install sqlite3 -v '1.3.13'不可用且需要安装(即使我已安装它)。

我已经尝试删除gem锁文件,并且仍然没有捆绑。如果有人能够告诉我哪里出错了,我会很高兴,因为我不知道出了什么问题。

1 个答案:

答案 0 :(得分:1)

参考这篇文章:

https://devcenter.heroku.com/articles/sqlite3

heroku不支持Sqlite,因为它使用短暂的文件系统,因此数据库将被定期擦除。

您可以使用sqlite作为开发数据库,​​但需要使用类似

的内容
gem 'pg' 

在生产中。您只需从gemfile中删除sqlite或将其移动到其中一个开发/测试组。

如果您在应用程序中使用数据库,则还需要使用正确的配置设置config / database.yml文件。