反应本机watchmanResponse无法解析root

时间:2016-03-01 06:13:13

标签: react-native watchman

使用版本0.20.0构建我的react-native项目时出错:

Looking for JS files in
   /Users/rockyl/WorkSpaces/react-native/TinySNS 

[13:55:06] <START> Building Dependency Graph
[13:55:06] <START> Crawling File System
[13:55:06] <START> Loading bundles layout
[13:55:06] <END>   Loading bundles layout (1ms)
[Hot Module Replacement] Server listening on /hot

React packager ready.

 ERROR  unable to resolve root /Users/rockyl/WorkSpaces/react-native/TinySNS: failed to opendir(/Users/rockyl/WorkSpaces/react-native/TinySNS): No such file or directory
{"watchmanResponse":{"version":"4.4.0","error":"unable to resolve root /Users/rockyl/WorkSpaces/react-native/TinySNS: failed to opendir(/Users/rockyl/WorkSpaces/react-native/TinySNS): No such file or directory"}}
Error: unable to resolve root /Users/rockyl/WorkSpaces/react-native/TinySNS: failed to opendir(/Users/rockyl/WorkSpaces/react-native/TinySNS): No such file or directory
    at BunserBuf.<anonymous> (/Users/rockyl/WorkSpaces/react-native/TinySNS/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:95:23)
    at emitOne (events.js:77:13)
    at BunserBuf.emit (events.js:169:7)
    at BunserBuf.process (/Users/rockyl/WorkSpaces/react-native/TinySNS/node_modules/react-native/node_modules/bser/index.js:289:10)
    at /Users/rockyl/WorkSpaces/react-native/TinySNS/node_modules/react-native/node_modules/bser/index.js:244:12
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.

这是日志: watchman logs 这是实时日志: watchman real-time logs

但根路径确实存在。

2 个答案:

答案 0 :(得分:1)

感谢发布这些日志;这里发生的事情是该路径中正在监视的WorkSpaces目录的大小写的问题。这有一些复杂的背景导致守望者需要知道文件名的确切大小,以便我们可以报告仅更改大小写的名称。

TL; DR是您应该要求React Native使用Workspaces作为目录名来观察路径,或者重命名目录以使其实际为WorkSpaces(换句话说,make确保您要求的路径与文件系统的路径完全匹配。

这里有一些守望者的错误,我会在此期间修复:

  1. 我们应该在观看的早期阶段使用我们严格的经典来规范这条路径(应该使用这个用例&#34;只是工作&#34;)
  2. 当出现这种不匹配时,我们应该用这个解释来表明这个错误

答案 1 :(得分:0)

简而言之:只需将项目所在的包含文件夹重命名为 workspaces(全部为小写),示例如下:

enter image description here