GruntJS “bus error grunt watch”

2019-06-22 07:14发布

I'm having an error with GruntJS when I try to run a grunt watch. It works fine, until there is a change in the file it is watching, then, it looks something like this:

Running "watch" task
Waiting...[1]    2464 bus error  grunt watch

The number 2464 changes. It seems to be the port that grunt is watching on? But, I'm not sure. Here is my 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']);
};

Thanks in advance for all the help!

2条回答
放我归山
2楼-- · 2019-06-22 07:47

Do you use Osx maverick?

checkout this: https://github.com/gruntjs/grunt-contrib-watch/issues/204

You need to upgrade node.js to 0.10.22 version:

# 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

source: http://stephentvedt.com/blog/2013/11/16/grunt-js-watch-bus-error/

查看更多
唯我独甜
3楼-- · 2019-06-22 07:51

Invalid syntax in sass files can also cause grunt or gulp to exit with a bus error. If you've already updated node and reinstalled modules without any success, try running sass --watch <sass glob> and see if there are any errors (import loops can be safely ignored as the cause).

查看更多
登录 后发表回答