Rails sprocket 编译 CSS 资源时出错 - CHOWN 问题
我已经为此绞尽脑汁两天多了,似乎无法弄清楚问题出在哪里。这主要是与我的设置有关的问题,但如果有人能帮助我找到这个问题的解决方案,那么我将永远成为他的奴隶......!
我正在运行 Snow leopard(主机)和 VMware fusion,运行 Ubuntu Lucid 服务器(来宾操作系统)。不知何故,经过一番努力之后,我设法将我的工作空间从 Mac 共享到 Ubuntu。因此,本质上我已经能够在虚拟机上隔离我的开发环境,这使得整个开发团队可以轻松地处于同一环境中,而不管他们的主机操作系统/设置等如何。同时,它确实使一切变得简单,我遇到了由于链轮而发生的特定问题(我猜)。每次我更改样式表并重新加载时,我都会收到此错误:
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'
但奇怪的是,如果我重新加载页面两次或三次,CSS 就会编译并且一切正常。
对于我所做的每一个 css 更改,都要重新加载页面两次或三次,这真是太遗憾了。我已经尝试过一些会员资格和权限,但作为一个业余爱好者,我想我还没有冒险足够深入。
大家有什么想法吗?
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 ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我有同样的问题。我的解决方案是在预编译资产后修改文件权限:
I have the same problem. my solution is to modify the File Permission after precompile assets:
这个答案有点晚了,但每次部署应用程序时 chmod 似乎不是一个好的解决方案。我认为问题是您的 apache 实例和乘客实例以不同的用户身份运行。因此,解决方案是检查您的 apache 服务器运行的用户身份并设置 PassengerDefaultUser,
例如:
这对我有用。由于 Passenger 使文件只能被任何人读取,奇怪的是,如果您只是刷新几次,就会出现一些问题,但确保它们是同一用户会阻止此错误。
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:
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.
我遇到了同样的错误,但在开发中!
清理并重新编译资产后解决:
I experienced the same error, but in development!
Solved after clean and recompile assets:
确保底层文件系统支持请求的操作。
以下命令为我解决了这个问题。
Make sure the underlying file system supports the requested operation.
The following commands fixed it for me.