user1868185
user1868185

Reputation: 899

heroku 1st time push encounters an error that rejects the push i tried to do

I'm fairly new to Ruby and I tried to push my code to Heroku, but it seems that when I tried:

git push heroku master

It failed in the push and displayed this error:

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 [email protected]:rigpirate.git
    ! [remote rejected] master -> master (pre-receive hook declined)
   error: failed to push some refs to '[email protected]:testapp.git'

This is what it displayed after I submitted the push command to Heroku. I think it is because of my code in the gem file here:

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'

Can anybody help me with this one?

Upvotes: 1

Views: 216

Answers (2)

fivedigit
fivedigit

Reputation: 18672

Currently you put the sqlite3 gem inside the development and test groups. If you'd want to deploy with sqlite3 on Heroku, you need to include it in the production group as well, which is as simple as removing the group :development, :test.

Do note that using sqlite3 on Heroku is most likely a bad idea, and you would be better off using Heroku Postgres. Read the Heroku documentation for more information.

Upvotes: 1

user1868185
user1868185

Reputation: 899

after a while of searching i saw the answer here

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

I just needed to install PG and then do a

sudo apt-get install libpq-dev

and then the push to heroku worked

Upvotes: 0

Related Questions