DEV Community

pabli44
pabli44

Posted on

πŸš€ Dev Tip: How to fix the ENOSPC error in Linux! 🐧

Have you ever tried running npm start, ng serve, or npm run dev on Ubuntu only to be met with a massive "System limit for number of file watchers reached" error? 😱

Despite the ENOSPC code, it doesn't mean your SSD is full! πŸ›‘ What’s actually happening is that your project (Angular, React, or Vite) has grown so large that it exceeded the number of files the Linux Kernel is allowed to "watch" in real-time.

Here is how to fix it forever in 3 simple steps:

1️⃣ Check your current limit:
Run this in your terminal to see how many files you can watch right now:
cat /proc/sys/fs/inotify/max_user_watches
(If it says 8192, that’s way too low for modern development!)

2️⃣ Boost it immediately (Temporary fix):
Give your system "more room to breathe" right away:
sudo sysctl fs.inotify.max_user_watches=524288

3️⃣ Make it permanent (The Pro move):
To ensure the fix sticks after a reboot:

Open the config file: sudo nano /etc/sysctl.conf

Add this line at the very end: fs.inotify.max_user_watches=524288

Save and apply: sudo sysctl -p

And that's it! Your dev environment can now handle thousands of files without breaking a sweat. πŸ˜ŽπŸ’»



You know, enjoy learning!!

Top comments (0)