0

我真的对 Heroku 的问题感到困惑。我是一个新手,我已经尝试了一些解决方案,但它们似乎对我没有帮助。这是我使用的错误

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

在 gem 文件中,这是我对 sqlite 3 的条目

Gem files will remain installed in /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
   An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
!
!     Failed to install gems via Bundler.
!     
!     Detected sqlite3 gem which is not supported on Heroku.
!     https://devcenter.heroku.com/articles/sqlite3
!
!     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:glacial-wildwood-5205.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:glacial-wildwood-5205.git'
4

2 回答 2

1

heroku 不支持sqlite3,请Postgresql改用。

group :development do
   gem 'sqlite3'
end

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

这样 sqlite 将成为您的本地数据库,而 postgres 将用于测试和生产

于 2013-06-27T17:24:38.680 回答
1

你会想要改变你的 Gemfile

添加gem 'pg'到您的生产组

group :production do
  gem "pg"
end

然后一定要bundle install在你提交到heroku之前运行

整个指南应该可以帮助您入门:https ://devcenter.heroku.com/articles/ruby#using-a-sql-database

于 2013-06-27T17:31:06.310 回答