使用Jest测试失败,错误:查看文件更改时出错:EMFILE [英] Testing with Jest failed with Error: Error watching file for changes: EMFILE
问题描述
一切都进行得很好,但使用Git跟踪目录(用它进行Git备份)。
测试失败,错误在
2017-01- 15 05:05 node [1278](FSEvents.framework)FSEventStreamStart:register_with_server:ERROR:f2d_register_rpc()=> (null)(-22)2017-01-15 05:05 node [1278](FSEvents.framework)FSEventStreamStart:register_with_server:ERROR:f2d_register_rpc()=> (null)(-22)events.js:160 throw呃; //未处理的'错误'事件^错误:观察文件更改时出错:FSEvent.FSWatcher._handle.onchange(fs.js:1406:11)的exports._errnoException(util.js:1022:11)上的EMFILE
我确信这是因为 .git
目录,因为当我删除 .git
目录,它正在运行没有错误。
似乎在查看文件时发生异常。
我的开发环境是MacOS 10.12.2和Node 6.9.4。
我如何解决这个问题?
哦,我在挣扎的几个小时后回答我的问题。
最好的解决方案是安装最新版本的 Watchman 。
旧版Watchman导致 fsevents
模块抛出异常。
I tried to write a test for a React.js app. Everything was going fine but after making the directory tracked with Git(made a Git repo with it). The test fails with the error below
2017-01-15 05:05 node[1278] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-15 05:05 node[1278] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
throw er; // Unhandled 'error' event
^
Error: Error watching file for changes: EMFILE
at exports._errnoException (util.js:1022:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
I am sure that this is because of .git
directory because when I remove .git
directory it is running without the error.
It seems that the exception occurs in watching the files.
My development environment is MacOS 10.12.2 and Node 6.9.4.
How can I resolve this issue?
Oh, I am going to answer my question after hours of my struggling.
The best solution is to install the latest version of Watchman.
The old version of Watchman causes fsevents
module throws the exception.
这篇关于使用Jest测试失败,错误:查看文件更改时出错:EMFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!