reactjs - React 服务器启动失败(仅在我重新启动系统时才有效)
问题描述
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”启动我的服务器时,我收到了这个错误。但是当我重新启动系统时它可以工作。问题是我无法每次都重新启动系统,因此了解一些其他解决方案对我很有帮助。谢谢!
解决方案
它达到了系统的文件观察者限制
尝试echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
推荐阅读
- sql - 创建具有多个条件的临时表
- javascript - React:当我的函数返回特定值时如何禁用按钮
- javascript - Rails 上的 Web 响应式页面
- excel - 24小时Excel时差
- c++ - 使用键盘和鼠标以连续/流动的方式移动相机?
- python - 如何在 Pandas 中对具有相同名称的不同行中的值进行分组?
- java - java - 如何从Java中的JComboBox中获取所选项目并将其与字符串进行比较?
- android - 如何仅为我的圆圈图标设置不同的大小?(安卓)
- python - 删除默认帮助命令不起作用 discord.py
- typescript - 确保接口与联合类型相同?