【解决】エラー:ENOSPC:デバイスに残されていないスペース、時計

私たちは、問題を発見しました。

ノードプロジェクトを開始しReactNative、エラーが発生した場合Error: 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

ソリューション:

#表示同一用户同时可以添加的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

:(この方法を使用することをお勧めします、次のように恒久的な方法があります)

vim /etc/sysctl.conf
fs.inotify.max_user_watches = 100000(后面值根据实际情况可自行调整)
添加并运行/sbin/sysctl -p即可 

ブート認証:

通常、再起動します

[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.

知識ポイント:

inotifyのデフォルトのカーネルパラメータ

  • /proc/sys/fs/inotify/max_queued_eventsデフォルト:16384ファイルアロケーション値は、この立派なイベントを超えて、キューに入れることができる最大値の場合にはinotifyインスタンスをinotify_initへの呼び出しの数が破棄されますが、イベントがトリガされますIN_Q_OVERFLOW
  • /proc/sys/fs/inotify/max_user_instancesデフォルト:128inotifyをinstatncesの最大数を指定し、すべての実ユーザIDを作成することができます
  • /proc/sys/fs/inotify/max_user_watchesデフォルト:8192関連した時計の上限を指定し、それぞれのinotifyインスタンス

注意:max_queued_eventsより頻繁にファイルシステムの最大長はバージョンinotifyキュー管理を変更し、この値が大きくなければなりません
あなたがログに表示された場合はEvent Queue Overflow、ことを示すmax_queued_eventsパラメータを使用すると、再び小さすぎて調整する必要があります。

おすすめ

転載: www.cnblogs.com/liyongjian5179/p/11584939.html