Rails sprocket Error compiling CSS assest - CHOWN issue
Asked Answered
B

4

6

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 ??

Bandaranaike answered 26/9, 2011 at 14:36 Comment(2)
I'm pretty sure this is a filesystem permissions problem.Hammonds
@Hammonds yup I'm pretty sure it's the same...although really can't figure out why it happens twice / thrice every time, and then simply works !Bandaranaike
M
2

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
Montiel answered 17/10, 2011 at 12:52 Comment(0)
V
2

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.

Vacuum answered 18/10, 2012 at 8:9 Comment(1)
How did you change this?Autocracy
P
1

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

 rake assets:clean && rake assets:precompile
Pikeperch answered 27/6, 2013 at 16:34 Comment(0)
A
0

Make sure the underlying file system supports the requested operation. The following commands fixed it for me.

mv public/assets /tmp
ln -s /tmp/assets public/assets
Abbie answered 21/4, 2014 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.