postgresql 检测到 Heroku 不支持的 sqlite3 gem
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21297160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Detected sqlite3 gem which is not supported on Heroku
提问by Katie H
I'm trying to push my rails app to Heroku, and I keep getting the following error:
我正在尝试将我的 rails 应用程序推送到 Heroku,但我不断收到以下错误:
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` 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 app
Here is what my gemfile looks like:
这是我的 gemfile 的样子:
group :devlopment, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Any ideas on how to fix this? Any help is much appreciated!
有想法该怎么解决这个吗?任何帮助深表感谢!
回答by Vandre
I have modified the gem file to use sqlite only on development, and test.
我已将 gem 文件修改为仅在开发和测试中使用 sqlite。
But, my mistake was: I have forgotten to commit the changes on git.
但是,我的错误是:我忘记在 git 上提交更改。
回答by Sergio A.
You have a typo:
你有一个错字:
group :development, :test do # <<<< :development, not devlopment
gem 'sqlite3'
end
As heroku ignores development specific gems, when running the bundle it includes sqlite3 gem.
由于 heroku 忽略特定于开发的 gem,因此在运行包时它包含 sqlite3 gem。
回答by sire
Try using this for production
尝试将其用于生产
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end
Additional information can be found here: https://devcenter.heroku.com/articles/sqlite3
可以在此处找到其他信息:https: //devcenter.heroku.com/articles/sqlite3
回答by u3829200
Try this
试试这个
heroku rake db:reset
heroku rake db:migrate