2

使用 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.

这是日志: 守望日志 这是实时日志: 守望者实时日志

但根路径确实存在。

4

2 回答 2

2

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

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

这里有几个守望者错误,我将同时修复:

  1. 我们应该在观察的早期阶段使用我们的严格标准规范化这条路径(应该让这个用例“正常工作”)
  2. 当发生这种不匹配时,我们应该用这种解释来揭示这个错误
于 2016-03-03T16:53:24.587 回答
0

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

在此处输入图像描述

于 2021-08-06T17:42:19.710 回答