AliOsm AliOsm - 21 days ago 7
Ruby Question

rake assets:precompile failed when push rails5 app to heroku

I'v finish my rails5 app with ruby 2.3.1 and try to push it to heroku and I'v got this error:

remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1.
remote: Please use
remote: `config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=31536000' }`
remote: instead.
remote: (called from <class:Application> at /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/config/application.rb:15)
remote: rake aborted!
remote: ArgumentError: wrong number of arguments (given 2, expected 1)
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `initialize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/heroku_rails_deflate-1.0.3/lib/heroku_rails_deflate/serve_zipped_assets.rb:16:in `new'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/heroku_rails_deflate-1.0.3/lib/heroku_rails_deflate/serve_zipped_assets.rb:16:in `initialize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `new'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `block in build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `each'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `inject'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/actionpack- `build'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `block in app'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `synchronize'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `app'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `block in <module:Finisher>'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `instance_exec'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `run'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `block in run_initializers'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `run_initializers'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `initialize!'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/config/environment.rb:5:in `<top (required)>'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `require'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `require_environment!'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/railties- `block in run_tasks_blocks'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote: /tmp/build_a89fafde7de9b83ca3fda752b1492a0d/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote: ! Push failed
remote: Verifying deploy...
remote: ! Push rejected to cdcnv.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

I'v try to delete
and ruby
bundle install
but again see the same error.

After that I try to edit my
but nothing happen and this it my

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true

# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = true

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true

# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = ''

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://'
# config.action_cable.allowed_request_origins = [ '', /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "my_gem_site_#{Rails.env}"
config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter =

# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger =
logger.formatter = config.log_formatter
config.logger =

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

This is my

source ''
ruby '2.3.1'

# Use credit_debit_card_number_validator as the default card number validator
gem 'credit_debit_card_number_validator'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>='
# Use postgresql as the database for Active Record
gem 'pg', '= 0.19.0.pre20160904200247'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more:
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more:
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'

group :production do
gem 'heroku_rails_deflate'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

I don't change anything in rails5 default app only add one controller with two methods and one view nothing more.

any ideas?


Finnaly I solve this problem with remove heroku_rails_deflate gem from my Gemfile and delete Gemfile.lock and rerun bundle install then push to heroku.

You can see the app from: