{"action":"created","issue":{"url":"https://api.github.com/repos/substack/node-browserify/issues/431","labels_url":"https://api.github.com/repos/substack/node-browserify/issues/431/labels{/name}","comments_url":"https://api.github.com/repos/substack/node-browserify/issues/431/comments","events_url":"https://api.github.com/repos/substack/node-browserify/issues/431/events","html_url":"https://github.com/substack/node-browserify/issues/431","id":15677828,"number":431,"title":"Error: EMFILE on OSX when requiring lots of files","user":{"login":"karl","id":3681,"avatar_url":"https://avatars.githubusercontent.com/u/3681?v=3","gravatar_id":"","url":"https://api.github.com/users/karl","html_url":"https://github.com/karl","followers_url":"https://api.github.com/users/karl/followers","following_url":"https://api.github.com/users/karl/following{/other_user}","gists_url":"https://api.github.com/users/karl/gists{/gist_id}","starred_url":"https://api.github.com/users/karl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karl/subscriptions","organizations_url":"https://api.github.com/users/karl/orgs","repos_url":"https://api.github.com/users/karl/repos","events_url":"https://api.github.com/users/karl/events{/privacy}","received_events_url":"https://api.github.com/users/karl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2013-06-18T09:36:42Z","updated_at":"2015-09-11T21:49:59Z","closed_at":"2013-12-20T01:08:32Z","body":"When requiring 256 files from a single file on OSX browserify throws:\r\n\r\n```\r\nError: EMFILE, open '/Users/karl/Sites/KVP/GuruFramework/package.json'\r\n```\r\n\r\nFrom Googling around it looks like this is caused by attempting to open too many files in parallel.\r\n\r\nIt looks like this could be solved by using the `graceful-fs` module to limit the number of files opened in parallel.\r\n\r\nhttps://github.com/isaacs/node-graceful-fs"},"comment":{"url":"https://api.github.com/repos/substack/node-browserify/issues/comments/139669270","html_url":"https://github.com/substack/node-browserify/issues/431#issuecomment-139669270","issue_url":"https://api.github.com/repos/substack/node-browserify/issues/431","id":139669270,"user":{"login":"jackcviers","id":660372,"avatar_url":"https://avatars.githubusercontent.com/u/660372?v=3","gravatar_id":"","url":"https://api.github.com/users/jackcviers","html_url":"https://github.com/jackcviers","followers_url":"https://api.github.com/users/jackcviers/followers","following_url":"https://api.github.com/users/jackcviers/following{/other_user}","gists_url":"https://api.github.com/users/jackcviers/gists{/gist_id}","starred_url":"https://api.github.com/users/jackcviers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackcviers/subscriptions","organizations_url":"https://api.github.com/users/jackcviers/orgs","repos_url":"https://api.github.com/users/jackcviers/repos","events_url":"https://api.github.com/users/jackcviers/events{/privacy}","received_events_url":"https://api.github.com/users/jackcviers/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T21:49:58Z","updated_at":"2015-09-11T21:49:58Z","body":"Here's a possible answer:\nhttp://serverfault.com/questions/108827/windows-file-handle-limit\n\nI know that even one build running through briwserify of a fairly large app\non mac would trigger the handle limit right away.\n\nI know the point of gulp is lost if you just use a single synchronous\nbuild, but for workaround purposes you could start with one and add a build\nat a time in parallel until you hit the limit. Then try to create a\nsequence of tasks for all your builds, limiting your parallelism to each\none to the amount that runs; e.g build one thru 3 don't depend on anything,\n3 thru six depend on one, two, and three, etc. That will be a minor pain in\ngulp, but might still give you acceptable throughput without crashing.\n\nOther possible workarounds, asuming w10 handler limit cannot be changed,\nare watchify, running your build in a docker / vagrant / environment where\nyou can set the limit appropriately, or vreaking your project into smaller\npieces with individual builds and common dependencies.\n\nOn Fri, Sep 11, 2015, 09:39 RangerMauve <notifications@github.com> wrote:\n\n> @jackcviers <https://github.com/jackcviers> I'm not so sure that's true\n> anymore. I only started having this issue after a Windows 10 update earlier\n> in the week. Before then it was all working properly.\n>\n> Also, it's not so much that I have a lot of dupes, I'm just running\n> several builds at once in a gulp script.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/substack/node-browserify/issues/431#issuecomment-139563348>\n> .\n>\n-- \nJack Viers\n333 E. Grand Ave.\n#115\nDes Moines, IA 50309\n515.313.7838\n"}}