React Native 错误:ENOSPC:达到文件观察器数量的系统限制

2023-12-30

我已经设置了一个新的空白反应本机应用程序。

安装几个节点模块后,我收到此错误。

Running application on PGN518.
internal/fs/watchers.js:173
   throw error;
   ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/badis/Desktop/react-native/albums/node_modules/.staging'
   at FSWatcher.start (internal/fs/watchers.js:165:26)
   at Object.watch (fs.js:1253:11)
   at NodeWatcher.watchdir (/home/badis/Desktop/react-native/albums/node modules/sane/src/node watcher. js:175:20)
   at NodeWatcher.<anonymous> (/home/badis/Desktop/react-native/albums/node modules/sane/src/node watcher. js:310:16)
   at /home/badis/Desktop/react-native/albums/node modules/graceful-fs/polyfills.js:285:20
   at FSReqWrap.oncomplete (fs.js:154:5)

我知道这与守望者没有足够的空间来监视所有文件更改有关。

我想知道在这里采取的最佳行动方案是什么?

我应该忽略吗node_modules文件夹,将其添加到.watchmanconfig ?


Linux 使用inotify http://man7.org/linux/man-pages/man7/inotify.7.html用于观察文件系统事件、单个文件或目录的包。

由于 React / Angular 在保存时热重载和重新编译文件,因此需要跟踪所有项目的文件。增加 inotify 监视限制应该会隐藏警告消息。

你可以尝试编辑

# insert the new value into the system config
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

# check that the new value was applied
cat /proc/sys/fs/inotify/max_user_watches

# config variable name (not runnable)
fs.inotify.max_user_watches=524288
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

React Native 错误:ENOSPC:达到文件观察器数量的系统限制 的相关文章

随机推荐