运行一个nodejs项目,发现一直报错Error: EMFILE: too many open files, watch
ulimit
tioncico@acbc32866c55 ~ % ulimit -a -t: cpu time (seconds) unlimited -f: file size (blocks) unlimited -d: data seg size (kbytes) unlimited -s: stack size (kbytes) 8192 -c: core file size (blocks) 0 -v: address space (kbytes) unlimited -l: locked-in-memory size (kbytes) unlimited -u: processes 2784 -n: file descriptors 524288 tioncico@acbc32866c55 ~ % sudo ulimit -n 524288 Password: tioncico@acbc32866c55 ~ %
修改完ulimit -n发现还是会报错
修改launchctl
tioncico@acbc32866c55 ~ % launchctl limit cpu unlimited unlimited filesize unlimited unlimited data unlimited unlimited stack 8388608 67104768 core 0 unlimited rss unlimited unlimited memlock unlimited unlimited maxproc 2784 4176 maxfiles 524288 524288 tioncico@acbc32866c55 ~ % sudo launchctl limit maxfiles 524288 524288 tioncico@acbc32866c55 ~ % launchctl limit cpu unlimited unlimited filesize unlimited unlimited data unlimited unlimited stack 8388608 67104768 core 0 unlimited rss unlimited unlimited memlock unlimited unlimited maxproc 2784 4176 maxfiles 524288 524288 tioncico@acbc32866c55 ~ %
竟然还是不行
最后重新安装watchman 解决
brew reinstall watchman