When using node to watch a project with something like nodemon, there will usually be an error like ENOSPC: System limit for number of file watchers reached...

This is due to system defaults and this limit can easily be increased with a few simple commands.

This can occur when trying to start up any kind of project that watches files for things like hot reloading as well as any piece of software that would want to keep watch on files to detect changes and take actions based on those changes such as Visual Studio Code,

“Visual Studio Code is unable to watch for file changes in this large workspace” (error ENOSPC)

When you see this notification, it indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files.

[bat] A cat clone with wings.

The current limit can be viewed by running cat or, even better, bat which as they say themselves, [bat] A cat(1) clone with wings which just means it has auto syntax highlighting, better output formatting in general, is available on Docker, Mac OSX and basically all flavors of Linux.

$ cat /proc/sys/fs/inotify/max_user_watches
# returned value:  8192

The limit can be increased to its maximum (524288) by editing /etc/sysctl.conf and appending this line to the file.


You can do by opening up your favorite text editor and adding the line or by running:

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

The value appended will be printed to the console if the append worked.

The new value can then be loaded/sourced by running:

$ sudo sysctl -p

This should be the only time you have to do this until you have to set up a new system again.

We're going to save you some time here. Definitely sync your VS Code settings across your computers to save you big time in the end!

Eat 'em, freeze 'em, enjoy 'em all week long!
Tayler Tayler (75)
35 minutes

Nothing says good morning quite like a breakfast sandwich. From the doughiness of the muffin to the eggs' fluffiness to the cheese's gooeyness, breakfast sandwiches are a great start to your morning.