Reputation: 16373
Upgrading from rails 5.2
to rails 6.0.1
, I get the following error when loading a page in development mode:
Sprockets::FileNotFound - couldn't find file 'leaders.source.coffee'
Checked in these paths:
app/assets/audios
app/assets/config
app/assets/images
...
My app/javascripts directory does not have any filed called leaders.source.coffee
or any file starting with leaders
. I have searched my code base and I could not find any reference to leaders
.
My manifest file is
#app/assets/config/manifest.js is
//= link_tree ../images
//= link_tree ../audios
//= link application.css
//= link application.js
//= link print.css
How do I fix this?
Upvotes: 7
Views: 2058
Reputation: 16373
I am not sure why, but setting debug to false fixed this, i.e.
config.assets.debug = false
If this does not work, or you cannot permanently use this setting, you might like to try @Guillaume Petit's answer below.
Upvotes: 7
Reputation: 416
Removing the cache folder did the trick for me
rm -rf tmp/cache
Upvotes: 5
Reputation: 10089
My problem was require_tree .
was pulling in a coffeescript file in a subdirectory. If the file is present, I get an error message it cannot find it in the root directory. The file is empty with no code, just comments so I deleted it but then I get an error message that it cannot find it when looking in the subdirectory.
I solved this by downversioning from sprockets 4.0.2
to `3.7.2'.
gem 'sprockets', '3.7.2'
Upvotes: 3
Reputation: 21
I get the same error if I call rails generate controller [controllername]
from the command line, but not if I manually make a controller. I'm guessing there's some sort of version conflict in what's generating the files, and what's running the files. It's not much more work to just manually make the things, so I'm just using that as a workaround.
The solution was to go into app/assets/javascripts/
and delete the coffee file generated there. Our guess is that the boilerplate code we're working off of (we're students) is the source of the problem.
Upvotes: 1