problem found:
Start node project ReactNative
when an error occursError: ENOSPC: no space left on device, watch
[root@iz2zeihk6kfcls5kwmqzj1z JFReactNativeProject]# npm start
> [email protected] start /app/jenkins_workspace/workspace/JFReactNativeProject
> react-native start
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro running while developing on any JS projects. Feel free to │
│ close this tab and run your own Metro instance if you prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/app/jenkins_workspace/workspace/JFReactNativeProject
Loading dependency graph...fs.js:1413
throw error;
^
Error: ENOSPC: no space left on device, watch '/app/jenkins_workspace/workspace/JFReactNativeProject/node_modules/.staging/react-native-ddd311e5/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection'
at FSWatcher.start (fs.js:1407:26)
at Object.fs.watch (fs.js:1444:11)
at NodeWatcher.watchdir (/app/jenkins_workspace/workspace/JFReactNativeProject/node_modules/[email protected]@sane/src/node_watcher.js:159:22)
at Walker.<anonymous> (/app/jenkins_workspace/workspace/JFReactNativeProject/node_modules/[email protected]@sane/src/common.js:109:31)
at Walker.emit (events.js:182:13)
at /app/jenkins_workspace/workspace/JFReactNativeProject/node_modules/[email protected]@walker/lib/walker.js:69:16
at go$readdir$cb (/app/jenkins_workspace/workspace/JFReactNativeProject/node_modules/[email protected]@graceful-fs/graceful-fs.js:187:14)
at FSReqWrap.oncomplete (fs.js:169:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-native start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-09-25T06_57_58_754Z-debug.log
Solution:
#表示同一用户同时可以添加的watch数目(watch一般是针对目录,决定了同时同一用户可以监控的目录数量)
[root@iz2zeihk6kfcls5kwmqzj1z JFReactNativeProject]# cat /proc/sys/fs/inotify/max_user_watches
8192
[root@iz2zeihk6kfcls5kwmqzj1z JFReactNativeProject]# echo 100000 > /proc/sys/fs/inotify/max_user_watches
[root@iz2zeihk6kfcls5kwmqzj1z JFReactNativeProject]# cat /proc/sys/fs/inotify/max_user_watches
100000
Permanent methods are as follows :( recommend using this method)
vim /etc/sysctl.conf
fs.inotify.max_user_watches = 100000(后面值根据实际情况可自行调整)
添加并运行/sbin/sysctl -p即可
Boot authentication:
Start again, normal
[root@iz2zeihk6kfcls5kwmqzj1z JFReactNativeProject]# npm start
> [email protected] start /app/jenkins_workspace/workspace/JFReactNativeProject
> react-native start
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro running while developing on any JS projects. Feel free to │
│ close this tab and run your own Metro instance if you prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/app/jenkins_workspace/workspace/JFReactNativeProject
Loading dependency graph, done.
Knowledge points:
The default kernel parameters of inotify
/proc/sys/fs/inotify/max_queued_events
Default:16384
the file allocation value is the number of calls to inotify_init inotify instance in the event of the maximum value that can be queued, beyond this worthy event is discarded, but the event will trigger IN_Q_OVERFLOW/proc/sys/fs/inotify/max_user_instances
Default:128
specifies the maximum number of inotify instatnces every real user ID can be created/proc/sys/fs/inotify/max_user_watches
Default:8192
Specifies the upper limit of watches each inotify instance associated
Note: max_queued_events
the more frequent the maximum length of the file system changes Inotify queue management, this value should be greater
if you see in the log Event Queue Overflow
, indicating that max_queued_events
the use of parameters need to be adjusted again too small.