[Linux] Error: ENOSPC: System limit ...

I can do general frontend work, but I’m not specialized in front end. Today when I run up the front-end project, I met the following issue.

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

The reason is that there is restriction of opening files by one process in Linux. The default number of opening file might be too limited especially when you run with webpack. The solution is to increase the limitation. You can change as below.

sudo vi /etc/sysctl.conf

# Add the below on the end of the file 
fs.inotify.max_user_watches=524288

sudo sysctl -p

If this post helped you to solve a problem or provided you with new insights, please upvote it and share your experience in the comments below. Your comments can help others who may be facing similar challenges. Thank you!
Buy Me A Coffee
DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !