Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt: Fatal error: watch EPERM

You can view/clone the full code here: https://github.com/mlewisTW/grunt-tests

I'd like to watch the src directory (to minify, concat, less, etc), which puts everything into the build dir. I'd also like to watch the build dir in order to livereload. Here's the watch config snippet:

watch: {
        options: {
            livereload: false
        },
        build: {
            files: ['<%= srcDir %>/**/*'],
            tasks: 'build'
        },
        reload: {
            files: ['<%= buildDir %>/**/*'],
            options: {
                livereload: true
            }
        }
    },

I'm on Windows 8. I'm getting a Fatal error: watch EPERM when I change a file, and it starts the first step of the build task (clean). I'm guessing this has something to do with the fact that I'm trying to delete a watched directory.

Is there a way to turn off the livereload watch task when I build, and then restart it when its finished?

Is there another/better way to do this?

like image 266
Michael Lewis Avatar asked Sep 08 '14 20:09

Michael Lewis


1 Answers

From Github issues:

EPERM on Windows means that you can delete or write to a file.

It is usually because another process is holding a handle to the file.

Sometimes, this happens a bit randomly with nodeJS on Windows. I find it is fine if you run it a second time.

like image 151
Dinesh Rawat Avatar answered Nov 13 '22 09:11

Dinesh Rawat