Chokidar does not watch for changes in Linux

2.2k Views Asked by At

thought I was all good and was in happy coding days when I got chokidar to do what I needed to do on my Macbook, but as soon as I got home and pulled into my local Ubuntu environment, the expected behaviour did not work at all.

On MacOS, the below works fine but fails in Ubuntu

var watcher = chokidar.watch('./', {
  ignored: ['node_modules', 'package.json', 'index.yaml', '.git', /(^[\/\\])\../],
  persistent: true
});
watcher.on('all', path => { updateYAML(); });

What happens in MacOS is this monitors my files and anytime I make changes, my yaml file is re-built. BUT in Linux, after I run my node command the app stops unexpectedly.

I found that if I changed the path from './' to just '.' then the app does not stop, but it does kick off of adding all the files in my directories and building my yaml file for each file in my directories.

My other main problem is that when in Ubuntu, it doesn't actually watch any files for changes while on the MacOS, it works perfectly...

Anyone have any experience with chokdidar working outside of MacOS?

Thanks

0

There are 0 best solutions below