文章目录
问题1 - Cannot read property ‘root’ of null
- 详细报错信息:
<START> fs crawl
TypeError: Cannot read property 'root' of null
at /Users/wusuowei/Documents/WorkSpace/20160525/Demo/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/wusuowei/Documents/WorkSpace/20160525/Demo/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/wusuowei/Documents/WorkSpace/20160525/Demo/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/wusuowei/Documents/WorkSpace/20160525/Demo/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:408:9)
at process._tickCallback (node.js:337:13)
-
原因
watchman版本需要更新
-
解决
$ brew update
$ brew uninstall watchman
$ brew unlink watchman
$ brew install watchman --HEAD
-
注意
假如你的Homebrew安装的比较早,就有可能更新时会遇到相关的权限问题,你可以参考Homebrew简介和基本使用解决.
问题2 - Unable to resolve module ReactDefaultPerf from
-
详细报错信息:
Unable to resolve module ReactDefaultPerf from /Users/wusuowei/Documents/WorkSpace/20160525/Demo/node_modules/react-native/Libraries/react-native/react-native.js: Unable to find this module in its module map or any of the node_modules directories under /Users/node_modules/ReactDefaultPerf and its parent directories
```
-
原因
react版本和react-native版本不匹配。1
-
解决
$ npm install <react@version>
示例:
$ npm install react@15.0.2
-
注意
在完整的报错信息中会有提示你移除当前所有的node modules和watchman的相关操作,我尝试后发现并没有解决问题,同时也有官方issue的提示,遇到类似问题,你可以先看看这个问题的解决和回复,然后在决定如何解决。(ps,重新下载所有的node依赖太慢了)
参考
相关
注解
- react 15.1.0 match react-native 0.27.0-rc
- react 15.0.2 match react-native 0.26.x
官方issues中的回复中可以注意到: ↩︎