Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails sprocket Error compiling CSS assest - CHOWN issue

I've been breaking my head over this for over 2 days now, and can't seem to figure out where the problem is. This is mostly a problem related to my setup, but if anyone could help me find a solution to this problem, then I'll be his slave for eternity..!

I'm running Snow leopard(host) and VMware fusion running Ubuntu Lucid server (guest OS). Somehow after a lot of head-banging I managed to get my workspace shared from Mac to Ubuntu. So, essentially I've been able to isolate my dev environment on a VM, which makes it easy for the entire dev team to be on the same environment irrespective of their host OS / setting, etc. While, it certainly has made everything easy, I'm stuck with a specific problem occurring due to sprockets (I guess). Every time I make changes to my stylesheets and reload, I get this error:

Error compiling CSS asset

Errno::EPERM: Operation not permitted - /mnt/hgfs/banjarey/tmp/cache/assets/DCF/780/sprockets%2F5f78b3457def1d02bd3fb75d4e0cfb63

/home/coderboy/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/core_ext/file/atomic.rb:38:in `chown'

The strage thing though is that if I reload the page twice or thrice, the css compiles and everything works alright.

It's a real shame to be reloading the page twice or thrice for every single css change I make. I've played around with memberships and permissions a little bit, but been an amateur I've not ventured deep enough I guess.

Any idea folks ??

like image 855
hashpipe Avatar asked Sep 26 '11 14:09

hashpipe


3 Answers

I have the same problem. my solution is to modify the File Permission after precompile assets:

#chown apache.root yourapp -R
#chmod 755 yourapp -R
like image 137
inruby Avatar answered Nov 12 '22 05:11

inruby


A bit late with this answer, but chmod everytime the app is deploy does not seem to be a good solution. I think the issue is your apache instance and your passenger instance are running as different users. So the solution is to check what user your apache server is running as and set the PassengerDefaultUser,

For example:

PassengerDefaultUser www-data

This worked for me. As Passenger was making files only readable by nobody, weird is that if you just refresh a few times it some how works out, but making sure they are the same user stops this error.

like image 39
BrianOqr Avatar answered Nov 12 '22 05:11

BrianOqr


I experienced the same error, but in development! Solved after clean and recompile assets:

 rake assets:clean && rake assets:precompile
like image 1
Fernando Kosh Avatar answered Nov 12 '22 06:11

Fernando Kosh