Sprockets::Rails::Helper::AssetNotPrecompiled: application.css

3.4k Views Asked by At

I get the following error when running my rspec test on CircleCI or Heroku Integration testing. However, it does not appear when running locally.

--- Caused by: ---

     # Sprockets::Rails::Helper::AssetNotPrecompiled:

     #   application.css

I tried adding:

I tried adding config.assets.debug = false to my test environment, but still fails on Heroku and CircleCI, but passes locally.

I found the following:

https://github.com/phfdonda/story-weavers/pull/2

https://github.com/rmosolgo/graphiql-rails/issues/75

https://github.com/rails/sprockets/issues/633

https://github.com/rails/sprockets/issues/690

My manifest file is:

//= link_tree ../images
//= link application.css
//= link application.js

adding a precompile in the test environment does not fix the issue..

 config.assets.precompile += ['application.js', 'application.css']
1

There are 1 best solutions below

0
On BEST ANSWER

Figured out I needed to add the following to my circleci config file:

  - run:
      name: Precompile Assets
      command: bundle exec rake assets:precompile

and similar for heroku..

https://www.dwightwatson.com/posts/rails-with-webpacker-on-heroku-ci