Rails App Assets Not Being Loaded on Development Environment

1.3k views Asked by At

Every time I spin up my Rails App locally, none of the CSS shows up. The debugger in the browser shows a get request for all of the asset files with fingerprinting, but they all fail since the files can't be found. Here is what one of those requests looks like:

GET http://localhost:3000/assets/announcements.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1

In the Rails Server Console, I get a Rack App Error, as well as a NoMethodError for the undefined method 'Silence'. Here is what one of those errors looks like:

2017-01-08 17:24:49 -0800: Rack app error handling request { GET /assets/normalize.self-cadbbf81015902777c37852b3ea54398335fd421c6c76891c077ec5954211bb4.css }

NoMethodError: undefined method 'silence' for #<Logger:0x007fe1062c1c78

Both Error logs (Browser Console and Localhost Server Console) contain multiple renditions of the same error, all pointing to Assets (*.js, and *.css).

I have searched through countless StackOverflow Posts but to no avail. This also for some reason only affects this one application; all my other Rails applications run fine. Here are my specifications:

Rails Version: 5.0.1

Ruby Version: 2.3.1p112

Things I have tried:

assets:clean, assets:precompile, rm -rf /tmp and /public/assets directpories, all of the previous prepended with the development environment, recloning the repository from github and bundle installing.

3

There are 3 answers

0
puneet18 On

check The Sprockets 4 Manifest in rails 5

http://eileencodes.com/posts/the-sprockets-4-manifest/

It might help you.

1
Ryan Bigg On

It looks like you're running into this issue: https://github.com/rails/sprockets-rails/issues/376.

Where you've made this configuration change you should be using ActiveSupport::Logger instead. Where you have Logger.new, use ActiveSupport::Logger instead.

1
cpt_peter On

I know this is an old question, but stumbled across this while trying to fix the same problem.

I found as well as Ryan Bigg's answer I needed to comment out the following line in development.rb to stop Sprockets from bombing in Rails 5.2.2:

  # Suppress logger output for asset requests.
  # config.assets.quiet = true