RN开发使用expo创建项目遇到如下错误: Logs for your project will appear below. Press Ctrl+C to exit. (node:18489) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated (Use node --trace-deprecation ...
to show where the warning was created) Error: ENOSPC: System limit for number of file watchers reached, watch ‘/home/vncuser/.wp/expo/weather/node_modules/concat-map’ at FSWatcher. (internal/fs/watchers.js:218:26) at Object.watch (fs.js:1525:34) at NodeWatcher.watchdir (/home/vncuser/.wp/expo/weather/node_modules/sane/src/node_watcher.js:159:22) at Walker. (/home/vncuser/.wp/expo/weather/node_modules/sane/src/common.js:109:31) at Walker.emit (events.js:315:20) at Walker.EventEmitter.emit (domain.js:467:12) at /home/vncuser/.wp/expo/weather/node_modules/walker/lib/walker.js:69:16 at FSReqCallback.oncomplete (fs.js:171:23) error Command failed with exit code 1.
Linux使用inotify包来观察文件系统事件,单个文件或目录。 由于React / Angular在保存时热重载和重新编译文件,因此需要跟踪所有项目文件。
解决问题方法该错误的意思是系统监视的文件数量已达到限制!! 解决方案: 修改系统监控文件数 我的是CentOS7,其他系统应该差不多
sudo vim /etc/sysctl.conf
在底部添加一行
fs.inotify.max_user_watches=524288
然后保存并退出! 命令:
sudo sysctl -p
执行结果:
sudo sysctl -p
fs.inotify.max_user_watches = 524288
这样就解决了!
参考https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached/55763478#55763478