【问题标题】:Error: EMFILE, too many connections错误:EMFILE,连接太多
【发布时间】:2013-03-03 15:57:59
【问题描述】:

在安装 NPM 时,我得到:

npm http 304 https://registry.npmjs.org/grunt-contrib-uglify
npm http 304 https://registry.npmjs.org/grunt-contrib-qunit
npm ERR! TypeError: Bad argument
npm ERR!     at Object.fs.close (fs.js:306:11)
npm ERR!     at Object.fs.close (/usr/local/Cellar/node/0.8.21/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:92:17)
npm ERR!     at null.<anonymous> (/usr/local/Cellar/node/0.8.21/lib/node_modules/npm/lib/utils/fetch.js:31:8)
npm ERR!     at EventEmitter.emit (events.js:96:17)
npm ERR!     at emit (fs.js:1500:14)
npm ERR!     at WriteStream.flush (fs.js:1504:9)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.2.0
npm ERR! command "/usr/local/Cellar/node/0.8.21/bin/node" "/usr/local/bin/npm" "install"

/usr/local/Cellar/node/0.8.21/lib/node_modules/npm/lib/utils/error-handler.js:247
  log.error("cwd", process.cwd())
                           ^
Error: EMFILE, too many open files
    at process.errorHandler (/usr/local/Cellar/node/0.8.21/lib/node_modules/npm/lib/utils/error-handler.js:247:28)
    at process.EventEmitter.emit (events.js:126:20)

我在 osx 上。我试过sudo ulimit -n 10480,上面写着:

$ ulimit
unlimited

运行 npm 版本:

{ http_parser: '1.0',
  node: '0.8.21',
  v8: '3.11.10.25',
  ares: '1.7.5-DEV',
  uv: '0.8',
  zlib: '1.2.3',
  openssl: '1.0.0f',
  npm: '1.2.11',
  shopper4: '0.1.0' }

有什么想法吗?非常感谢!

【问题讨论】:

    标签: python npm towerjs


    【解决方案1】:

    在 OSX 上,您应该使用 launchctl

    检查电流限制:

    launchctl limit
    

    更改最大文件数:

    launchctl limit maxfiles 400000 unlimited
    

    要永久更改设置,请编辑/etc/launchd.conf

    limit maxfiles  400000           unlimited
    

    (来自:http://artur.hefczyc.net/node/27

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-08
      • 2018-04-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-15
      • 2017-10-29
      • 1970-01-01
      相关资源
      最近更新 更多