问题
Trying to boot up a Rails app inside a Vagrant box (percise32) host machine is Windows 7. This is my Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.hostname = 'rails-dev-box'
config.vm.synched_folder "c:\rails_text", "/home/code"
config.vm.network :forwarded_port, guest: 3000, host: 3003
config.vm.provision :puppet do |puppet|
puppet.manifests_path = 'puppet/manifests'
puppet.module_path = 'puppet/modules'
end
end
When i try to run the app (code is syncing correctly) i am getting the following error on the Rails server output:
Errno::ETXTBSY in Welcome#index
Showing /home/code/app/views/layouts/application.html.erb where line #4 raised:
Text file busy - (/home/code/tmp/cache/sass/a0a09a036cf07b1cae262d60fa989a8e24765858/welcome.css.scssc20131001-1595-f6clpt, /home/code/cache/sass/a0a09a036cf07b1cae262d60fa989a8e24765858/welcome.css.scssc)
(in /home/code/app/assets/stylesheets/welcome.css.scss)
Some articles suggested that moving my synced folder outside of the /vagrant root is the cure, but it seems that it is not the issue in my case since i am using /home/code
ideas welcome.
回答1:
Looks like the gem for Sass recently updated (like yesterday or today) Go to the Gemfile and set the sass version to 3.2.10, then bundle update
gem 'sass', '3.2.10' # 3.2.11 broke the app
回答2:
Solution of user2840051 work .. You need to uninstall sass
gem uninstall sass
Choose version to uninstall
Modify your Gemfile with:
gem 'sass', '3.2.10'
And finally run:
bundle update sass
回答3:
I got the same problem, after sass was upgraded to 3.2.12. My solution was to move sass cache out of synced folder to a proper linux filesystem:
options[:cache_location] = "/tmp/sass-cache"
回答4:
I had the same problem with grunt/sass and vagrant.
Message was:
vagrant@precise32:~$ grunt
Running "sass:dist" (sass) task
Errno::ETXTBSY: Text file busy @ sys_fail2 - (./.sass-cache/8147710423c1a1d0096b06b58f36e8601f62e931/main.scssc20140302-6017-1phv8qn, ./.sass-cache/8147710423c1a1d0096b06b58f36e8601f62e931/main.scssc)
Use --trace for backtrace.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
The fix is, to add cacheLocation option into Gruntfile.js, sample config below.
module.exports = function(grunt) {
grunt.initConfig({
sass: {
dist: {
options: {
style: 'compressed', // compact
lineNumbers : false, // true
cacheLocation: '/tmp/sass-cache'
},
},
},
});
}
回答5:
As a general system-wide fix
gem uninstall sass
gem install sass -v 3.2.10
来源:https://stackoverflow.com/questions/19124367/rails-app-on-percise32-vagrant-box-assets-get-text-file-busy-error-errnoe