rails development environment circular dependency error
-
27-05-2021 - |
题
Last night I think I did something that hosed my rails development environment, and I'm unable to reverse what I did.
I migrated an update to production and was having some trouble precompiling a stylesheet so I backed out the changes and decided to attempt a precompile on my development machine.
Long story short, the precompile failed on my development machine (local) but when I tried to bring up my test system I got this error:
Sprockets::CircularDependencyError in Devise/sessions#new
/app/assets/stylesheets/application.css has already been required
I'm certain this has something to do with my attempted precompile, even though it failed because prior to that everything was working fine.
I tried to do precompile:clear because I read somewhere that will reverse/delete the precompile.
Am I missing something here? Does a precompile change configuration files somewhere that I need to manually reset?
This is rails 3.1 running on Ubuntu 11.10.
解决方案
This is happening because your application.css.scss is most likely requiring a css file that's requiring application.css.scss. You'll want to go through app/assets/stylesheets
and check the headers of application.css.scss
, and then the headers of all the files it requires to make sure that none of them reference application.css.scss
.
其他提示
I fixed it by creating an application.css.scss and by importing each of my files in there, like this:
@import "backend.css.scss"; @import "frontend.css.scss";
then it worked