Skip to content

BroccoliTypescriptCompiler failed with EMFILE: too many open files #864

Closed

Description

@alexkibler

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Windows 7 x64
  1. Versions. Please run ng --version. If there's nothing outputted, please
    run in a Terminal:
    1.0.0-beta.5
  2. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Created a new app with the CLI. Generated one service. Tried ng test. Got this error.
  3. The log given by the failure. Normally this include a stack trace and some
    more information.
The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: EMFILE: too many open files, open 'c:\Users\rakibler\Projects\efile\tmp\broccoli_type_script_compiler-input_base_path-3mf1JMd2.tmp\0\src\tsconfig.json'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at BroccoliTypeScriptCompiler._loadTsConfig (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:123:34)
    at BroccoliTypeScriptCompiler._createServiceHost (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:158:25)
    at BroccoliTypeScriptCompiler.build (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:41:12)
    at c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\index.js:152:21
    at lib$rsvp$$internal$$tryCatch (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

The broccoli plugin was instantiated at:
    at BroccoliTypeScriptCompiler.Plugin (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\index.js:10:31)
    at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\broccoli-caching-writer\index.js:21:10)
    at BroccoliTypeScriptCompiler (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:27:10)
    at Angular2App._getTsTree (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\angular2-app.js:321:18)
    at Angular2App._buildTree (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\angular2-app.js:116:23)
    at new Angular2App (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\lib\broccoli\angular2-app.js:53:23)
    at module.exports (c:\Users\rakibler\Projects\efile\angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:55:19)
    at Class.module.exports.Task.extend.init (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:89:10)
    at new Class (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\node_modules\core-object\core-object.js:18:12)
    at Class.module.exports.Task.extend.run (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\lib\tasks\build-watch.js:17:16)
    at c:\Users\rakibler\Projects\efile\node_modules\angular-cli\addon\ng2\commands\test.js:69:46
    at lib$rsvp$$internal$$tryCatch (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (c:\Users\rakibler\Projects\efile\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1198:9)

Activity

  1. randyaa commented on May 20, 2016

    @randyaa

    I'm running into this same issue. My setup is just about the same except it's not a freshly generated CLI project with a single service. In my case the project is a few months old with approximately 350 spec files and a lot of other code.

  2. cjblomqvist commented on May 21, 2016

    @cjblomqvist

    I have the same issue with a newly created project using ng new. I dug a little bit more into the details, and it seems non-trivial to fix. Broccoli is assuming things are running synchronously so it's not trivial to queue up reading certain files (such as using graceful-fs). I've also done significant googling and the issue might be related to broccoli/ember-cli not doing proper cleanup on Windows.

    btw. I've tested both with Node 5.x and 6.x. Same issue.

    Quick workaround (at least for new projects in my scearnio) is to use --watch false flag or --build false. This works (I believe) since then not so many files are synchronously opened.

  3. maku commented on May 25, 2016

    @maku

    I have the same problem (Win7 64) when I run tests (ng test).
    It works without watching (--watch false)
    Project is really small but with material2 dependencies

  4. petarblazevski commented on May 25, 2016

    @petarblazevski
    Contributor

    A workaround is to increase the ulimit: ulimit -n 1024 fixed my problem. But now i have another problem. How do i increase this on Travis CI for example? My builds are failing on this issue from a pull request.

  5. alexkibler commented on May 26, 2016

    @alexkibler
    Author

    @maku Yeah, it doesn't error right out for me. However, I get 26 05 2016 14:34:05.769:WARN [Chrome 50.0.2661 (Windows 7 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

    EDIT: This seems to just be because of how pitifully slow my work computer is. If I disable the timeout, the tests do run, but they take quite a while.

  6. JSMike commented on May 26, 2016

    @JSMike
    Contributor

    hmm, I was trying to solve this by doing a ng build -prod and then running ng test --path dist/ but it's saying The option '--path' is not registered with the test command. run 'ng test --help for a list of supported optionsbut when I runng test --helpit lists--path` as an option for using a pre-built directory.

  7. GaryWenneker commented on May 29, 2016

    @GaryWenneker

    @JSMike even running with

    ng test -e prod

    doesn't do the trick

  8. Mattek1979 commented on Jun 2, 2016

    @Mattek1979

    I had the same problem, didn't work even with running in elevated. Watching this video: https://www.youtube.com/watch?v=wHZe6gGI5RY&list=PLOETEcp3DkCq788xapkP_OU-78jhTf68j&index=24. I tried running npm link angular-cli in command window manually and it solved my problems. I'm on a restricted windows 7 machine behind firewall.

  9. filipesilva commented on Jun 2, 2016

    @filipesilva
    Contributor

    I was able to reproduce the EMFILE problem and am tracking it in #977.

    The only solution I have at the moment is to separately run ng serve and ng test --build=false.

    Increasing the file limit via ulimit -n 1024 should work, but that would be necessary in every dev machine of the team, plus CI, which makes it impractical. Will continue looking for a solution.

  10. Caroga commented on Mar 16, 2017

    @Caroga

    Increasing the file limit via ulimit -n 1024 should work, but that would be necessary in every dev machine of the team, plus CI, which makes it impractical. Will continue looking for a solution.

    @filipesilva I am curious if you have found anything else ?

  11. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  12. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions