Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached
Asked Answered
P

3

10

This morning when running npm start, I get the error:

System limit for number of file watchers reached

Because /proc/sys/fs/inotify/max_user_watches has returned to its initial value (8192) (How to Increase max_user_watches)

I'm on a new React@17 project with MaterialUI & formik. This post show the commands I ran to get started.

By modifying max_user_watches to 81920 it's work. However I would like to lower the consumption of my CPU/RAM

**How to tell my project (react VSC) to be less greedy **

Protohistory answered 13/5, 2022 at 14:22 Comment(1)
Does this answer your question? React Native Error: ENOSPC: System limit for number of file watchers reachedZonda
A
22

I was also facing the same problem and tried the following command,

sudo sysctl fs.inotify.max_user_watches=524288
Alterable answered 12/8, 2022 at 12:25 Comment(0)
H
0

It works for me: sudo sysctl fs.inotify.max_user_watches=524288

fs.inotify.max_user_watches=524288

The new value can then be loaded in by running sudo sysctl -p.

While 524,288 is the maximum number of files that can be watched, if you're in an environment that is particularly memory constrained, you may want to lower the number. Each file watch takes up 1080 bytes, so assuming that all 524,288 watches are consumed, that results in an upper bound of around 540 MiB.

Note: Please set this inside VS CODE Terminal, give your computer password and then set the watcher value. It will work first.

Hymn answered 24/4 at 2:54 Comment(0)
C
0

I just restarted my computer and it worked, the issue stoped. You might want to give it a try.

Although I think the other solutions are more accurate to this issue. 👇

sudo sysctl fs.inotify.max_user_watches=524288
Corie answered 6/5 at 18:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.