Chris J. Lee

Dallas Drupal Developer

You are here

[Grunt Contrib Watch] Error: "Warning: watch ENOSPC" warnings

I had issues with this particular error regarding grunt-contrib-watch on Ubuntu 13.04:

Problem: "Warning: watch ENOSPC" warnings

Running "watch" task
Waiting...Warning: watch ENOSPC

Running "watch" task
Waiting...Warning: watch ENOSPC

Running "watch" task
Waiting...Warning: watch ENOSPC

Running "watch" task
Waiting...Warning: watch ENOSPC

Running "watch" task
Waiting...Warning: watch ENOSPC

Running "watch" task
Waiting...Warning: watch ENOSPC

This loops and loops until no end. I've tried the same gruntfile on windows and it seems to work fine. I also was able to avoid this issue by sudo'ing. But that causes another permissions issue. It's bizarre. I eventually discovered the solution to this after some more research.

Solution

Apparently the solution is this one liner:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

There's a hard coded limit to how many files one can watch on Debian based linux machines. This will increase the number of file watches. File watches quickly get to the hard limit if you have an application like dropbox running.

I'm a bit cautious. I would also backup your sysctl.conf file if you need to before running it. Otherwise, i've backed it up on gists if you need a Ubuntu 13.04 version of it: https://gist.github.com/chrisjlee/79fa596697d2bc1e57cf

More resources

Tags: 
errorgrunt
© 2017 Chris J. Lee