Node.js – How to fix Error: ENOSPC: System limit for number of file watchers reached

Node.js

I will show you how to fix Error: ENOSPC: System limit for number of file watchers reached.

If you read the previous article, you have to update your last change.

We are going to fix the following error message.

node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch 'src'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2247:34)

1. Open sysctl.conf file (/etc/sysctl.conf)

2. Update the following statement

fs.inotify.max_user_watches=524288

to

fs.inotify.max_user_watches=1524288

3. Apply changes without restart

sudo sysctl -p

4. Run watcher

Conclusion

When you get this error, update/increase the previous value from 524288 to a higher number.

https://www.mldgroup.com

Vyštudovaný top manažér pôsobiaci najmä ako manažér, marketér, softvérový inžinier, konzultant, bloger, YouTuber a zatiaľ neúspešný hudobník a producent. V rámci praxe pôsobil v rôznych odvetviach na rôznych pozíciách v malých aj veľkých firmách, vrátane spoluprác a partnerstiev s významnými firmami či poradenskými spoločnosťami.

Pridaj komentár

Vaša e-mailová adresa nebude zverejnená. Vyžadované polia sú označené *