Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 7 x64- Versions. Please run
ng --version. If there's nothing outputted, please
run in a Terminal:
1.0.0-beta.5- 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. Triedng test. Got this error.- 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)
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.
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.
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
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.
@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.
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.
@JSMike even running with
ng test -e prod
doesn't do the trick
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.
I was able to reproduce the EMFILE problem and am tracking it in https://github.com/angular/angular-cli/issues/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.
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 ?
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._
Most helpful comment
I was able to reproduce the EMFILE problem and am tracking it in https://github.com/angular/angular-cli/issues/977.
The only solution I have at the moment is to separately run
ng serveandng test --build=false.Increasing the file limit via
ulimit -n 1024should 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.