node.js 报错Error: ENFILE: file table overflow...ENFILE: file table overflow, open...

在MAC上启动nodejs,遇到了一个问题:

node.js 报错Error: ENFILE: file table overflow...ENFILE: file table overflow, open..._第1张图片

主要大概是说文件打开太多了,超过了限制。

产生这个问题主要是苹果操作系统的限制,具体参考这个ISSUE

I'm glad this is solving it for everyone. Unfortunately, Apple sets ridiculously low limits by default which might be good for some users, but is awful for developers.
For what it's worth, I would recommend setting the limit much much higher than 65536 (524288 is great).
Additionally, I would recommend using a method that doesn't modify /etc/ files directly since throughout the years Apple has randomly decided to stop loading these files (for example, it used to be a common recommendation to put this in /etc/launchd.conf, but that no longer works in Yosemite).

解决办法的设置如下:

echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536

 

你可能感兴趣的:(Angular)