【问题标题】:heroku fails to take a rails applicationheroku 无法获取 rails 应用程序
【发布时间】:2013-06-25 07:53:22
【问题描述】:

我真的对 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'

【问题讨论】:

    标签: ruby ruby-on-rails-3 heroku


    【解决方案1】:

    heroku 不支持 sqlite3 ,请改用 Postgresql

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

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

    【讨论】:

    • 如何删除 sqlite3 并添加 postgresql?
    • Gem files will remain installed in /home/aravind/.bundler/tmp/15662/gems/pg-0.12.2 for inspection. Results logged to /home/aravind/.bundler/tmp/15662/gems/pg-0.12.2/ext/gem_make.out An error occurred while installing pg (0.12.2), and Bundler cannot continue. Make sure that gem install pg -v '0.12.2'` 在捆绑之前成功`这是我按照你说的做时遇到的错误。请帮忙。
    • 另请注意,您可能需要更新某些模型才能在 postgre 中正常工作
    • 嗯.. 看起来您可能需要安装 postgres?检查这个问题 -> stackoverflow.com/questions/11439207/…
    【解决方案2】:

    你会想要改变你的 Gemfile

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

    group :production do
      gem "pg"
    end
    

    那么在你提交到heroku之前一定要运行bundle install

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

    【讨论】:

      猜你喜欢
      • 2018-04-22
      • 2016-10-28
      • 2011-05-18
      • 1970-01-01
      • 2015-10-30
      • 2016-06-23
      • 2016-05-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多