'(Angular) Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached

I'm trying to make a project in angular but when I try to compile it shows me these errors over and over till my IDE closes.

Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers 
reached, watch '/home/pedro/Universidad/Vacas-Dic2021/Archivos/LAB/MIA_Proyecto2_201709146_201900612/SoccerStatistics/node_modules/typescript'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers 
reached, watch '/home/pedro/Universidad/Vacas-Dic2021/Archivos/LAB/MIA_Proyecto2_201709146_201900612/SoccerStatistics/node_modules/typesript/lib' 

I'm using angular 12 and node 14.17.6



Solution 1:[1]

You can check it out here to increase the size of the watch.

Solution 2:[2]

If you can not increase the size of the watch (fs.inotify.max_user_watches), you can still compile angular using this command :

ng serve --watch --live-reload --poll 2000

Worked for me, and I am using virtual-studio-code as IDE

Solution 3:[3]

Remove node_modules and reinstall packages

(Not the best solution because this bug comes back after restarting the computer)

rm -rf node_modules
yarn install

That does the trick for me :)

Solution 4:[4]

You can run this command to resolve the problem.

sudo sysctl -w fs.inotify.max_user_watches=524288

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jerethom
Solution 2 Pyx
Solution 3
Solution 4 nagender pratap chauhan