Open too many files (EMFILE error) in Windows 7

I use Node.js (0.10.31) and Gulp (3.8.8) to automate some tasks in Windows 7, but I encountered the following error:

events.js:72 throw er; // Unhandled 'error' event ^ Error: EMFILE, open 'c:\myproject\package.json' 

I moved the project to Ubuntu and fixed it with the ulimit -n command, but still wondering how to solve this on Windows.

Now, first, I want to know if there are any restrictions preventing the opening of more files / sockets in Windows 7 that cause EMFILE error or not?

Secondly, if so, how can I change this restriction?

+8
windows windows-7 gulp
source share
1 answer

There is a limitation in the VSC ++ environment. An application can only open 512 file descriptors at runtime, although the value can be increased to 2048 if the application calls _setmaxstdio (which, in my opinion, node). (This is a somewhat simplified explanation, see here for more details.) You cannot directly change this restriction (you can only raise 512 to 2048 if you get a node to call this function for you somehow).

However, you wrote that you are using node v0.10.31, which is pretty old. As far as I know (although I'm not 100% sure of this), the node, meanwhile, has switched from using the VSC ++ environment for file I / O to its own WinAPI calls that do not have this limitation, so you can try the latest version of node if This is an option for you.

+3
source share

All Articles