10

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?

Michael Lewis
  • 4,252
  • 6
  • 28
  • 39
  • Did you ever find a solution to this? I'm having the same issue. – Brett Pennings Oct 02 '15 at 15:16
  • https://github.com/angular-app/angular-app/issues/163 -> it seems a "random" Windows issue, according to this issue after first time, a second "grunt watch" solves the issue. Can you try it? Otherwise it could be something permission related, is your shell/git shell/ sth running in administration mode ? – Fer To Oct 07 '15 at 09:31
  • El Capitan is also experiencing this, some have said due to the rootless change where /usr/bin is no longer writeable. Are you on El Capitan? – beta208 Oct 09 '15 at 19:37
  • Permissions of Node & NPM can be a bit messy when installed manually or via a package manager. I suggest trying it by installing [NVM](https://github.com/creationix/nvm) which goes under your personal directory and has no permission collisions. The repo above works fine in my env and I'm using node `v6.2.0` – rels Jul 06 '16 at 06:45

1 Answers1

1

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.

Derek Brown
  • 4,232
  • 4
  • 27
  • 44
Dinesh Rawat
  • 970
  • 10
  • 32
  • 1
    As pointed out by @Dave Foster, in the future you should probably cite the source of an answer if you copy it verbatim. – Derek Brown Mar 20 '18 at 15:13