首页 > 解决方案 > 无法启动 react-native start

问题描述

尝试运行“react-native start”命令时,我从终端收到以下消息。

Loading dependency graph...internal/fs/watchers.js:170
    throw error;

Error: ENOSPC: no space left on device, watch '/home/junior/ReactNative/ToDoList/android/gradle'
    at FSWatcher.start (internal/fs/watchers.js:164:26)
    at Object.watch (fs.js:1232:11)
    at NodeWatcher.watchdir (/home/junior/ReactNative/ToDoList/node_modules/sane/src/node_watcher.js:159:22)
    at Walker.<anonymous> (/home/junior/ReactNative/ToDoList/node_modules/sane/src/common.js:109:31)
    at Walker.emit (events.js:182:13)
    at /home/junior/ReactNative/ToDoList/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/junior/ReactNative/ToDoList/node_modules/graceful-fs/graceful-fs.js:162:14)
    at FSReqWrap.oncomplete (fs.js:141:20)

当我运行“$react-native run-android”cmd 时,第一个屏幕截图显示模拟器屏幕

第二张图片是我通过双击 R 重新加载应用程序时的屏幕截图

标签: androidreact-nativereact-native-android

解决方案


在 android 中,您需要先手动启动 Metro Bundler!

直接在终端启动 Metro Bundler

react-native start

现在运行react-native run-androidreact-native run-ios在另一个选项卡中

是的,如果您遇到类似的错误,Error: ENOSPC: no space left on device, watch '/home/junior/ReactNative/ToDoList/android/gradle' at FSWatcher.start (internal/fs/watchers.js:164:26) at Object.watch (fs.js:1232:11) at NodeWatcher.watchdir (/home/junior/ReactNative/ToDoList/node_modules/sane/src/node_watcher.js:159:22) at Walker. (/home/junior/ReactNative/ToDoList/node_modules/sane/src/common.js:109:31) at Walker.emit (events.js:182:13) at /home/junior/ReactNative/ToDoList/node_modules/walker/lib/walker.js:69:16 at go$readdir$cb (/home/junior/ReactNative/ToDoList/node_modules/graceful-fs/graceful-fs.js:162:14) at FSReqWrap.oncomplete (fs.js:141:20)则需要删除当前的模拟器并创建带有附加空格的新模拟器,

如果您在终端中遇到任何问题,那么您也可以重置您的 npm 数据

清理缓存

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all


推荐阅读