【问题标题】:Cannot read property 'root' of null React Native iOS无法读取 null React Native iOS 的属性“根”
【发布时间】:2016-11-16 00:40:49
【问题描述】:

我从昨天开始就遇到了这个问题,无法解决。我已经浏览了所有为 react native 和 watchman 提交的 github 问题,没有一个有助于解决问题。

当我尝试使用命令在我的项目文件夹中启动 react-native 时:

react-native start

在终端中抛出以下日志:

[4:57:26 PM] 构建依赖关系图 [4:57:27 PM] 爬取文件系统 [Hot Module Replacement] 服务器监听 /hot

React 打包器准备就绪。

无法构建 DependencyGraph:Watchman 错误:无法读取属性 null 的“根”。确保 watchman 正在为此项目运行。看 https://facebook.github.io/watchman/docs/troubleshooting.html。错误: 守望者错误:无法读取 null 的属性“根”。确保 watchman 正在为这个项目运行。看 https://facebook.github.io/watchman/docs/troubleshooting.html。 在 /Users/anum/Desktop/Practice/QuizReact/node_modules/node-haste/lib/crawlers/watchman.js:63:11 在 process._tickCallback (internal/process/next_tick.js:103:7)

我已将 watchman 和 brew 更新到最新版本。请有人能指出我解决这个问题的正确方法吗?谢谢。

【问题讨论】:

    标签: ios react-native watchman


    【解决方案1】:

    最后我成功地运行了 react native 应用。我首先使用 npm 更新了:

    sudo npm update
    

    我删除了我的旧项目,创建了一个新的 react native 项目。然后一步步执行这些命令,感谢person commented:

    brew update
    brew uninstall watchman
    brew install watchman --HEAD
    

    这次日志确实显示 brewwatchman 都已更新。上次我运行命令时,他们指出我的守望者已经更新。很可能是因为 npm 太旧了,并且没有满足 react-native 的要求。因此,请确保您已将所有 react-native 内容更新到最新版本。

    更新 watchman 后,我在我的项目目录中启动了react-native 服务器:

    react-native start
    

    在那之后,我能够成功构建并运行该项目而没有任何错误。希望这个答案对某人有所帮助!

    【讨论】:

      猜你喜欢
      • 2016-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-13
      • 1970-01-01
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      相关资源
      最近更新 更多