heroku第一次推送遇到一个错误,拒绝我试图做的推

时间:2014-12-15 16:14:25

标签: heroku ruby-on-rails-4.2

我对Ruby很新,我试图将我的代码推送到Heroku,但似乎当我尝试时:

git push heroku master

推送失败并显示此错误:

Bundle completed (25.17s)
   Cleaning up the bundler cache.
   -----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   DEPRECATION WARNING: Paths in SQLite3 database URLs of the form `sqlite3:///path` will be treated as absolute in Rails 4.2. Please switch to `sqlite3:dbname`. (called from <top (required)> at /tmp/build_9b82245b019e78f91f12b14e50aeac25/Rakefile:6)
   rake aborted!
   Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:190:in `rescue in spec'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:187:in `spec'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:50:in `establish_connection'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:129:in `block (2 levels) in <class:Railtie>'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:118:in `block in <class:Railtie>'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/config/environment.rb:5:in `<top (required)>'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/application.rb:276:in `require_environment!'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/application.rb:389:in `block in run_tasks_blocks'
   /tmp/build_9b82245b019e78f91f12b14e50aeac25/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.2.1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
   Tasks: TOP => environment
   (See full trace by running task with --trace)
    !
    !     Precompiling assets failed.
    !

    !     Push rejected, failed to compile Ruby app

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

这是我向Heroku提交push命令后显示的内容。我认为这是因为我在这里的gem文件中的代码:

gem 'rails', '4.1.6'
group :development, :test do 
    gem 'sqlite3'
end
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'y
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development
gem 'devise'
gem 'simple_form'

有人可以帮我这个吗?

2 个答案:

答案 0 :(得分:1)

目前,您将sqlite3 gem放在developmenttest组中。如果您想在Heroku上使用sqlite3进行部署,则还需要将其包含在生产组中,这与删除group :development, :test一样简单。

请注意,在Heroku上使用sqlite3很可能是一个坏主意,你最好使用Heroku Postgres。 Read the Heroku documentation for more information

答案 1 :(得分:0)

经过一段时间的搜索,我看到了答案

 http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you//

我只需安装PG然后再做

sudo apt-get install libpq-dev

然后推送到heroku工作