Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 6 sprockets error, cannot find source.coffee file

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?

like image 960
Obromios Avatar asked Dec 14 '19 19:12

Obromios


3 Answers

I am not sure why, but setting debug to false fixed this, i.e.

config/environments/development.rb

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.

like image 98
Obromios Avatar answered Nov 09 '22 12:11

Obromios


Removing the cache folder did the trick for me

rm -rf tmp/cache
like image 22
Guillaume Petit Avatar answered Nov 09 '22 11:11

Guillaume Petit


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.

like image 1
WireHallMedic Avatar answered Nov 09 '22 10:11

WireHallMedic