2

I have created a react app through the command line and it started without facing any issues. But after editing my files in the src folder, the npm start, npm run start both went to a problem.

Here's the ERROR:

`events.js:174
  throw er; // Unhandled 'error' event
  ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ruwaid/ruwaid-blog/public/index.html' at FSWatcher.start (internal/fs/watchers.js:165:26) at Object.watch (fs.js:1258:11) at createFsWatchInstance (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15) at setFsWatchListener (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15) at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14) at FSWatcher.NodeFsHandler._handleFile (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:262:21) at FSWatcher. (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:495:21) at FSReqWrap.oncomplete (fs.js:154:5) Emitted 'error' event at: at FSWatcher._handleError (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10) at createFsWatchInstance (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5) at setFsWatchListener (/home/ruwaid/ruwaid-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15) [... lines matching original stack trace ...] at FSReqWrap.oncomplete (fs.js:154:5) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ruwaid-blog@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ruwaid-blog@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ruwaid/.npm/_logs/2021-01-14T18_29_11_988Z-debug.log`

  • 1
    Does this answer your question? [React Native Error: ENOSPC: System limit for number of file watchers reached](https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached) – cbr Jan 14 '21 at 18:44
  • also if you're using VSCode, add node_modules to VSCode's ignored directories so it doesn't watch the folder and use up watchers. – cbr Jan 14 '21 at 18:45
  • @cbr did you mean reinstalling node_modules? If yes, I've done that a lot but still ran into the same problem. I also downgraded my js scripts to `@2.1.8` and worked once – DeveloperRuwaid Jan 15 '21 at 16:18
  • The problem is that the development server (started by `react-scripts start`) listens to file changes with file system watchers, which on your OS, uses the linux `fs.inotify` API. There are OS limits for the amount of file system watchers, and since node_modules contains a huge amount of individual files, trying to listen to all of them at the same time pops the OS limit for the watchers. The answer I linked earlier tells you how to increase this limit. VSCode also listens to changes to update filenames etc in the file explorer, so if node_modules is not ignored, VSCode will also use watchers. – cbr Jan 15 '21 at 16:27
  • If you're not using VS Code, that's fine. Just increase the amount of inotify watchers like in the link I posted earlier. – cbr Jan 15 '21 at 16:29
  • I use vs code. And yeah, If I quickly run the npm start in my terminal after booting my Pc, It runs without any error but when I open it in Vscode and after some minutes, running the `npm start` runs to an error – DeveloperRuwaid Jan 16 '21 at 11:56
  • Always remember the guide https://stackoverflow.com/help/how-to-ask, it will make your questions much more welcoming to answers, and even keep them from the risk of being closed – HoRn Jan 16 '21 at 13:49
  • well I've got the issue its with the watch limit. I've increased my watch limitation and now works fine :) Anyways thanks for your kind attention @cbr – DeveloperRuwaid Jan 16 '21 at 18:05

0 Answers0