twn39 / code

:memo: 代码笔记,通过 issue 的方式记录日常遇到的问题和学习笔记
13 stars 1 forks source link

React native start 报错 #135

Open twn39 opened 7 years ago

twn39 commented 7 years ago
Scanning 561 folders for symlinks in /home/kevin/Projects/Firefly/node_modules (3ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  Running packager on port 8081.                                            │ 
 │                                                                            │ 
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native                                  │ 
 │                                                                            │ 
 └────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in
   /home/kevin/Projects/Firefly 

Loading dependency graph...
React packager ready.

 ERROR  watch /home/kevin/Projects/Firefly/node_modules/react-native/ReactAndroid/src/main/libraries/fbcore/src/main/java/com/facebook/common/logging ENOSPC
{"code":"ENOSPC","errno":"ENOSPC","syscall":"watch /home/kevin/Projects/Firefly/node_modules/react-native/ReactAndroid/src/main/libraries/fbcore/src/main/java/com/facebook/common/logging","filename":"/home/kevin/Projects/Firefly/node_modules/react-native/ReactAndroid/src/main/libraries/fbcore/src/main/java/com/facebook/common/logging"}
Error: watch /home/kevin/Projects/Firefly/node_modules/react-native/ReactAndroid/src/main/libraries/fbcore/src/main/java/com/facebook/common/logging ENOSPC
    at exports._errnoException (util.js:1023:11)
    at FSWatcher.start (fs.js:1306:19)
    at Object.fs.watch (fs.js:1331:11)
    at NodeWatcher.watchdir (/home/kevin/Projects/Firefly/node_modules/sane/src/node_watcher.js:144:20)
    at Walker.<anonymous> (/home/kevin/Projects/Firefly/node_modules/sane/src/node_watcher.js:353:12)
    at emitTwo (events.js:106:13)
    at Walker.emit (events.js:192:7)
    at /home/kevin/Projects/Firefly/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/kevin/Projects/Firefly/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqWrap.oncomplete (fs.js:112:15)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
twn39 commented 7 years ago

watchman监控的文件数超过了最大的设置数,将数值调大:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p