Michael Lewis
Michael Lewis

Reputation: 4302

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?

Upvotes: 10

Views: 2175

Answers (1)

Dinesh Rawat
Dinesh Rawat

Reputation: 1019

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.

Upvotes: 1

Related Questions