解决: macOS React Native 启动出现 “ENOSPC“ 错误

/home/xxxx/dev/xxxx/node_modules/metro-hermes-compiler/src/emhermesc.js:77
          throw ex;
          ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/xxxx/dev/xxxx/node_modules/@babel/helper-string-parser'
    at FSWatcher. (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2296:34)
    at NodeWatcher.watchdir (/home/xxxx/dev/xxxx/node_modules/metro/node_modules/jest-haste-map/build/watchers/NodeWatcher.js:156:24)
    at Walker. (/home/xxxx/dev/xxxx/node_modules/metro/node_modules/jest-haste-map/build/watchers/common.js:113:31)
    at Walker.emit (node:events:513:28)
    at /home/xxxx/dev/xxxx/node_modules/walker/lib/walker.js:69:16
    at FSReqCallback.oncomplete (node:fs:192:23) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/xxxx/dev/xxxx/node_modules/@babel/helper-string-parser',
  filename: '/home/xxxx/dev/xxxx/node_modules/@babel/helper-string-parser'
}

解决方案:

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

你可能感兴趣的:(React,react,native,react.js,javascript)