events.js:287
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vishal/react/hacker-stories/public'
at FSWatcher.start (internal/fs/watchers.js:169:26)
at Object.watch (fs.js:1339:11)
at createFsWatchInstance (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqCallback.oncomplete (fs.js:168:5)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/home/vishal/react/hacker-stories/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/home/vishal/react/hacker-stories/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[... lines matching original stack trace ...]
at FSReqCallback.oncomplete (fs.js:168:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/vishal/react/hacker-stories/public',
filename: '/home/vishal/react/hacker-stories/public'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
当我尝试使用“ yarn start”启动服务器时,出现此错误。但是,当我重新启动系统时,它可以工作。问题是我无法每次都重新启动系统,因此对我了解一些替代解决方案将非常有帮助。谢谢!
答案 0 :(得分:0)
达到系统文件查看器的限制
尝试echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p