NodeJS错误"EMFILE,打开的文件太多"在Mac OS上 [英] NodeJS error "EMFILE, too many open files" on Mac OS

查看:367
本文介绍了NodeJS错误"EMFILE,打开的文件太多"在Mac OS上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一段时间我遇到以下错误:

For sometime I am having the following error:

Error: EMFILE, too many open files  '/Users/blagus/Gallery/Websites/Nicsware/Pills/resources/core/auth.node.js'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Object.Module._extensions..js (module.js:473:44)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at instController  (/Users/blagus/Gallery/Websites/Nicsware/Pills/engine/mvc.node.js:79:31)
    at init (/Users/blagus/Gallery/Websites/Nicsware/Pills/engine/mvc.node.js:57:8)
    at route (/Users/blagus/Gallery/Websites/Nicsware/Pills/engine/dispatcher.node.js:268:36)

调用此文件(mvc.node.js:79)的代码行是

The line of code making the call to this file (mvc.node.js:79) is

    this.currentRoute.class = require( controllerFile )[dispatchClass].bind( this );

(这是我正在创建的框架)

(it is a framework I am creating)

如您所见,文件auth.node.js由REQUIRE调用,因此使用gracefullFS和类似方法提供的解决方案不适合.此外,此问题仅发生在MacOS上.在Ubuntu中似乎可以正常工作.

As you can see, the file auth.node.js is called by a REQUIRE, so the given solutions with gracefullFS and similar does not fit. Besides, this problem occour MacOS only. In a Ubuntu seems to work just fine.

有什么想法吗?

推荐答案

这对我有用:

ulimit -n 10480

在此处找到

这篇关于NodeJS错误"EMFILE,打开的文件太多"在Mac OS上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆