当我尝试运行grunt watch
时,我遇到了GruntJS的错误。
它工作正常,直到文件发生变化
看,然后,它看起来像这样:
Running "watch" task
Waiting...[1] 2464 bus error grunt watch
号码2464
发生了变化。它似乎是grunt正在观看的端口?但是,我不确定。这是我的Gruntfile:
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compact'
},
files: {
'css/style.css': 'sass/style.scss',
}
}
},
watch: {
files: 'sass/style.scss',
tasks: ['sass']
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['sass']);
};
提前感谢所有帮助!
答案 0 :(得分:24)
你使用Osx特立独行吗?
结帐:https://github.com/gruntjs/grunt-contrib-watch/issues/204
您需要将node.js升级到0.10.22版本:
# Check your version of Node.js. v0.10.20 will still be broken
node –v
# clean your node cache
sudo npm cache clean –f
# install node binary manager ’n’
sudo npm install -g n
# use said ’n’ manager to install latest stable version
sudo n stable
来源:http://stephentvedt.com/blog/2013/11/16/grunt-js-watch-bus-error/
答案 1 :(得分:1)
sass文件中的语法无效也会导致grunt或gulp退出并出现总线错误。如果您已经更新了节点并重新安装了模块但没有成功,请尝试运行sass --watch <sass glob>
并查看是否存在任何错误(可以安全地忽略导入循环作为原因)。