Search code examples
ruby-on-railsasset-pipelineprecompile

Assets Precompile Error


When I run rake RAILS_ENV=production assets:precompile --trace to precompile my assets for production I am getting this error. I added the production.rb file.

Invoke assets:precompile (first_time)
Invoke assets:environment (first_time)
Execute assets:environment
Invoke environment (first_time)
Execute environment
rake aborted! 
No such middleware to insert before: ActionDispatch:Static

production.rb

Rails.application.configure do

  config.cache_classes = true


  config.eager_load = true


  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  config.assets.js_compressor = :uglifier


  config.assets.compile = false

  config.server_static_assets = false

  config.log_level = :debug

  config.action_mailer.perform_caching = false

  config.log_formatter = ::Logger::Formatter.new


  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger = ActiveSupport::TaggedLogging.new(logger)
  end

  config.active_record.dump_schema_after_migration = false
end

This has been driving me crazy for two days. Any help is appropriated.


Solution

  • I figured it out I looked in the public folder and cleared out what was in there then ran rails assets:precompile and that created all new files with the finger prints at the end of the file name.

    I also had config.middleware.insert_before ActionDispatch::Static, Rack::Deflater in my application.rb I deleted this line and everything loaded up.