reactJS 中的 yarn start 不起作用。显示以下内容......
Error: watch /home/khiller/new-app/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/home/khiller/new-app/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
答案1
Listen 在 Linux 上默认使用 inotify 来监控目录的更改。系统对可监控文件数量的限制并不罕见。例如,Ubuntu Lucid(64 位)的 inotify 限制设置为 8192。
运行以下命令以避免 ENOSPC:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
对于 Arch Linux,将以下行添加到 /etc/sysctl.d/99-sysctl.conf:
fs.inotify.max_user_watches=524288
然后执行:
sysctl --system