I'm learning graphql and using prisma-binding for graphql operations. I'm facing this nodemon error while I'm starting my node server and its giving me the path of schema file which is auto generated by a graphql-cli. Can anyone tell me what this error is all about?


Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch '/media/rehan-sattar/Development/All projects/GrpahQl/graph-ql-course/graphql-prisma/src/generated

Rehan Sattar

Ответов: 8

Ответы (8)

If you are using Linux, your project is hitting your system's file watchers limit

To fix this, on your terminal, try:

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

In my case, while I'm doing the nodemon command in the Linux server. I have my VSCode open (SSH to the server). So based on @Juri Sinitson's answer, I just close the VSCode and run the nodemon command again. And it works.

My nodemon command: nodemon server.js via npm start

It can be hard to know how much to increase the number of watchers by. So, here's a utility to double the number of watchers:

function get_inode_watcher_count() {
  find /proc/*/fd -user "$USER" -lname anon_inode:inotify -printf '%hinfo/%f\n' 2>/dev/null | 
  xargs cat | 
  grep -c '^inotify'

function set_inode_watchers() {
  sudo sysctl -w fs.inotify.max_user_watches="$1"

function double_inode_watchers() {
  set_inode_watchers "$((watcher_count * 2))"

  if test "$1" = "-p" || test "$1" = "--persist"; then
    echo "fs.inotify.max_user_watches = $((watcher_count * 2))" > /etc/sysctl.d/10-user-watches.conf

# Usage
# to make the change persistent
double_inode_watchers --persist

You need to increase the inotify watchers limit for users of your system. You can do this from the command line with:

sudo sysctl -w fs.inotify.max_user_watches=100000

That will persist only until you reboot, though. To make this permanent, add a file named /etc/sysctl.d/10-user-watches.conf with the following contents:

fs.inotify.max_user_watches = 100000

After making the above (or any other) change, you can reload the settings from all sysctl configuration files in /etc with sudo sysctl -p.

I sometimes get this issue when working with VSCode on my Ubuntu machine.

In my case the following workaround helps:

stop the watcher, close VScode, start the watcher, open VSCode again.

I had the same problem, however mine was coming from webpack. Thankfully they hd a great solution on their site:

For some systems, watching many files can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like node_modules using a regular expression:


module.exports = {
  watchOptions: {
    ignored: /node_modules/

On Linux, I've actually run with sudo. sudo npm start

In order to test the changes, I set temporary the parameter with the value 524288.

sysctl -w fs.inotify.max_user_watches=524288

then I proceed to validate :

npm run serve

And the problem was solved, in order to make it permanent, you should try to add a line in the file "/etc/sysctl.conf" and then restart the sysctl service :

cat /etc/sysctl.conf |tail -n 2

sudo systemctl restart systemd-sysctl.service

2022 WebDevInsider