我从昨天开始就一直面临这个问题,无法解决。我已经浏览了为 react native 和 watchman 提交的所有 github 问题,没有一个有助于解决问题。
当我尝试使用命令在我的项目文件夹中启动 react-native 时:
react-native 启动
在终端中抛出以下日志:
[4:57:26 PM] Building Dependency Graph [4:57:27 PM] Crawling File System [Hot Module Replacement] Server listening on /hot
React packager ready.
Failed to build DependencyGraph: Watchman error: Cannot read property 'root' of null. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html. Error: Watchman error: Cannot read property 'root' of null. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html. at /Users/anum/Desktop/Practice/QuizReact/node_modules/node-haste/lib/crawlers/watchman.js:63:11 at process._tickCallback (internal/process/next_tick.js:103:7)
我已经将 watchman 和 brew 更新到最新版本。请有人能指出我解决这个问题的正确方法吗?谢谢。
最佳答案
终于成功运行了react native app。我首先使用以下方法更新了 npm:
sudo npm update
我删除了我的旧项目,创建了一个新的 React Native 项目。然后一步步执行这些命令,感谢person commented :
brew update
brew uninstall watchman
brew install watchman --HEAD
这次日志确实显示 brew 和 watchman 都更新了。上次我运行命令时,他们指出我的守望者已经更新。这很可能是因为 npm 太旧了,react-native
要求没有得到满足。所以请确保,您已将所有 react-native
内容更新到最新版本。
更新 watchman 后,我在我的项目目录中启动了 react-native
服务器:
react-native start
在那之后,我能够成功地构建和运行项目,没有任何错误。希望这个答案对某人有所帮助!
关于ios - 无法读取 null React Native iOS 的属性 'root',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38351459/