I am building a basic random quote machine in React. But when i run npm start
through terminal I get the the error.
I did some research online. I fond a solution that worked for me. Apparently, downgrading my [email protected]
to [email protected]
worked. But after I reboot my system, react-scripts changes back to 3.1.1
and produces the same error.
The error message is:
events.js:174
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/samman/Documents/kkk/public'
at FSWatcher.start (internal/fs/watchers.js:165:26)
at Object.watch (fs.js:1258:11)
at createFsWatchInstance (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqWrap.oncomplete (fs.js:154:5)
Emitted 'error' event at:
at FSWatcher._handleError (/home/samman/Documents/kkk/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/home/samman/Documents/kkk/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/home/samman/Documents/kkk/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! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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/samman/.npm/_logs/2019-08-18T11_06_36_567Z-debug.log
I had the same problem on Ubuntu and I followed these instructions.
I assume you are using linux as well by looking at the error.
Try this in terminal :
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Original Post
It’s hitting your system's file watchers limit.
Try echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -pRead more about what’s happening at https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With