Nodemon Error: “System limit for number of file watchers reached”

Updated (05/2023) There are some tips in the comments and I brought them to update this question. If you’re facing this problem, then you are probably using a Linux distro and your project is hitting your system’s file watchers limit. Check your current inotify file watch limit by executing: $ cat /proc/sys/fs/inotify/max_user_watches You can set … Read more

Nodemon – exclusion of files

In order to make NodeMon ignore a bunch of files from monitoring, you can start it as nodemon –ignore PATTERN [–ignore PATTERN2] where PATTERN is the name of a specific file, directory, or wildcard pattern. Make sure that if you use a wildcard, it is escaped. For example nodemon –ignore ‘lib/*.js’ –ignore README Alternatively, if … Read more

How to watch and reload ts-node when TypeScript files change

You can now simply npm install –save-dev ts-node nodemon and then run nodemon with a .ts file and it will Just Work: nodemon app.ts Previous versions: I was struggling with the same thing for my development environment until I noticed that nodemon‘s API allows us to change its default behaviour in order to execute a … Read more

How can nodemon be made to work with WSL 2?

Root cause: inotify is not fully supported in the 9P filesystem protocol on WSL2. There are several github issues on the WSL project related to this, but perhaps the most relevant is #4739. Possible Workarounds: Try nodemon -L (a.k.a. –legacy-watch) as Simperfy suggested. Try running from the default ext4 filesystem (e.g. mkdir -p $HOME/Projects/testserver). Note … Read more