Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: EMFILE: too many open files #512

Closed
samuelazran opened this issue Sep 21, 2015 · 13 comments
Closed

Error: EMFILE: too many open files #512

samuelazran opened this issue Sep 21, 2015 · 13 comments

Comments

@samuelazran
Copy link

I'm running jest on a limited linux box on codeanywhere and it gives me the' too many open files error".
When I'm using https://github.com/isaacs/node-graceful-fs it's just consuming all the RAM and not really working. so it get stuck on the "Using Jest CLI v0.5.4 " line.

Here is the command line log from when I'm not using node graceful-fs and running jest:

cabox@box-codeanywhere:~/workspace/vac$ npm test                                                                                                                                                                                                     

> vac@0.0.1 test /home/cabox/workspace/vac                                                                                                                                                                                                           
> jest __tests__/                                                                                                                                                                                                                                    

Using Jest CLI v0.5.4                                                                                                                                                                                                                                
Error reading file: `/home/cabox/workspace/vac/node_modules/webpack-dev-server/package.json`                                                                                                                                                         
/home/cabox/workspace/vac/node_modules/jest-cli/node_modules/node-            haste/lib/loader/ResourceLoader.js:88                                                                                                                                              
      throw err;                                                                                                                                                                                                                                     
            ^                                                                                                                                                                                                                                        
Error: EMFILE: too many open files, open '/home/cabox/workspace/vac/node_modules/webpack-    dev-server/package.json'                                                                                                                                    
  at Error (native)                                                                                                                                                                                                                                  

npm ERR! Test failed.  See above for more details.                                                                                                                                                                                                   
@johannhof
Copy link

Did you try using the ulimit command? http://blog.izs.me/post/56827866110/wtf-is-emfile-and-why-does-it-happen-to-me

@amasad
Copy link
Contributor

amasad commented Oct 6, 2015

Please bump your ulimit

@amasad amasad closed this as completed Oct 6, 2015
@ElOsus
Copy link

ElOsus commented Dec 18, 2015

Is there a solution for Windows? Changing the testDir in the packages.json brakes mocking.

@ggarnier
Copy link

I was getting this error in OSX, even with ulimit set to unlimited. After removing node_modules directory, updating npm and running npm install, it started working again.

@jberube
Copy link

jberube commented Jan 20, 2016

@ggarnier updating to which npm version?

Still trying to figure it all on Windows.

@ggarnier
Copy link

@jberube I just ran npm install npm@latest -g to update to the latest version (currently, 3.5.3)

@FlackMonkey
Copy link

@jberube , hi!
Still got issue on Windows (7 x67 sp1).
node : 5.6.0
npm : 3.7.1
jest: 0.8.2
babel-jest: 6.0.1 (enabling/disabling does nothing)

npm test:

> jest

Using Jest CLI v0.8.2, jasmine1
Error reading file: `D:\... \web\node_modules\gulp-less\node_modules\less\node_modules\request\node_modules\hawk\node_mo
D:\ ... \web\node_modules\jest-cli\node_modules\node-haste\lib\loader\ResourceLoader.js:88
      throw err;
      ^

Error: EMFILE: too many open files, open 'D:\ ... \web\node_modules\gulp-less\node_modules\less\node_modules\request\node
    at Error (native)
npm ERR! Test failed.  See above for more details.

UPD

testPathDirs in config solves problem with testing node_modules by default

config.testPathIgnorePatterns [array<string>] 
(default: ["/node_modules/"])

@cpojer
Copy link
Member

cpojer commented Feb 10, 2016

#599 is going to merge next week and it should resolve this problem too.

@panmona
Copy link

panmona commented Apr 3, 2019

I still run into this issue with ulimit=unlimited.

@ashb
Copy link

ashb commented May 29, 2019

For future: #8258 fixed this for me which was included in Jest 24.7.0 (I was on 24.3.1)

@alflennik
Copy link

I saw this issue on Jest 24.9.0, Node 13.6 and with the following ulimits:

$ ulimit -a
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       5568
-n: file descriptors                10496

Although the issue is completely intermittent, and might even depend on the terminal window I use (?) for example, I'm seeing it it my VSCode terminal but not my Zsh terminal 🧐

@ZeroDarkThirty
Copy link

I was getting this error in OSX, even with ulimit set to unlimited. After removing node_modules directory, updating npm and running npm install, it started working again.

This worked for me, although I had to run sudo npm install. Otherwise I was getting errors during the installation.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests