Hey there, I need help in fixing this error. When I run npm start command, I'm getting this error. Please help me out in fixing this.
events.js:174
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/swathi_vennela/Documents/Dev/react/dojo-blog/public'
at FSWatcher.start (internal/fs/watchers.js:165:26)
at Object.watch (fs.js:1258:11)
at createFsWatchInstance (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqWrap.oncomplete (fs.js:154:5)
Emitted 'error' event at:
at FSWatcher._handleError (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/home/swathi_vennela/Documents/Dev/react/dojo-blog/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/home/swathi_vennela/Documents/Dev/react/dojo-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! dojo-blog@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dojo-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/swathi_vennela/.npm/_logs/2021-03-11T18_14_25_594Z-debug.log
swathi_vennela@swathi-Aspire:~/Documents/Dev/react/dojo-blog$
Top comments (3)
Does it happen every time you run the command or only at specific times? By looking at the error code one can point out that too many applications are watching the same directory. You can try some solutions:
/tmp
npm dedupe
If that's not helpful, then you can try increasing the inotify watch limit (assuming that's a GNU/Linux based OS). Check out this link or this (macOS)
Will be easy to understand if you can share more information like project structure, where you are running the command etc.
Thanks everyone, it got fixed when i changed the command to "sudo npm start", as I work on Ubuntu