无法启动本机启动

时间:2018-11-16 04:15:09

标签: android react-native react-native-android

我在尝试运行“ 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)

First screenshot displays emulator screen when I run "$react-native run-android" cmd

Second pic is screenshot when I reloaded the app by double pressing R

2 个答案:

答案 0 :(得分:1)

  

在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

答案 1 :(得分:0)

尝试运行npm install -g react-native,然后再试