【问题标题】:Error: Watchman was not found in PATH in windows错误:在 Windows 的 PATH 中找不到 Watchman
【发布时间】:2017-03-03 11:19:20
【问题描述】:

我正在学习react-native 编程来开发android 应用程序。在运行时运行应用程序时,我遇到了一些错误unable to resolve module。我找到了一些链接,并建议运行此命令react-native start --reset-cache,而这又需要系统上的watchman。我安装了watchman 然后我无法启动react-native

react-native 开始

D:\React Native\Example 1\ExampleOne>react-native start
Scanning 560 folders for symlinks in D:\React Native\Example 1\ExampleOne\node_m
odules (27ms)
 ┌────────────────────────────────────────────────────────────────────────────┐

 │  Running packager on port 8081.                                            │

 │                                                                            │

 │  Keep this packager running while developing on any JS projects. Feel      │

 │  free to close this tab and run your own packager instance if you          │

 │  prefer.                                                                   │

 │                                                                            │

 │  https://github.com/facebook/react-native                                  │

 │                                                                            │

 └────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
   D:\React Native\Example 1\ExampleOne

Loading dependency graph...Watchman:  Watchman was not found in PATH.  See https
://facebook.github.io/watchman/docs/install.html for installation instructions

React packager ready.

jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
  Usually this happens when watchman isn't running. Create an empty `.watchmanco
nfig` file in your project's root folder or initialize a git or hg repository in
 your project.
  Error: Watchman was not found in PATH.  See https://facebook.github.io/watchma
n/docs/install.html for installation instructions
Watchman:  Watchman was not found in PATH.  See https://facebook.github.io/watch
man/docs/install.html for installation instructions
 ERROR  Watchman was not found in PATH.  See https://facebook.github.io/watchman
/docs/install.html for installation instructions
{"code":"ENOENT","errno":"ENOENT","syscall":"spawn watchman","path":"watchman","
spawnargs":["--no-pretty","get-sockname"]}
Error: Watchman was not found in PATH.  See https://facebook.github.io/watchman/
docs/install.html for installation instructions
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

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

D:\React Native\Example 1\ExampleOne>

我已成功安装watchman,当我尝试执行watchman 命令时,它正在发生

这是我的watchman 的安装位置。我也在我的 Windows 机器的 PATH 中添加了这个。 D:\React Native\Example 1\ExampleOne\node_modules\watchman

PATH 是 D:\React Native\Example 1\ExampleOne\node_modules\watchman

我不确定导致此问题的原因。我的路径是错误的还是我指向了 watchman 的错误目录?谁能建议我如何解决这个问题。提前致谢

【问题讨论】:

    标签: android npm react-native react-native-android


    【解决方案1】:

    你可以通过卸载watchman npm 包来解决这个问题。尝试全局和本地卸载npm uninstall -g watchmannpm uninstall watchman

    【讨论】:

    • 嗨@TGMCians,这个解决方案使'react-native start'能够运行,但是在运行'react-native run-android'时,我收到一条错误消息:EPERM:不允许操作, ... 并且模拟器的红色错误屏幕显示:无法获取 BatchedBridge,请确保您的捆绑包已正确打包。我正在使用 Windows 7 顺便说一句,你知道吗?谢谢!
    • 谢谢各位TGMC大佬的回复,没有解决问题,但是cmd中的错误信息没有了,唯一的问题是模拟器里的红屏,还是说:'Could没有得到 BatchedBridge,请确保您的捆绑包正确打包',我正在考虑是否应该重新安装守望者。你说什么?
    • @VincentZHANG 是的
    • 谢谢@TGMCians,又把cmd的错误带回来了,我又回到起点了。
    【解决方案2】:

    这通常发生在 watchman 没有运行时。在项目的根文件夹中创建一个空的.watchmanconfig 文件,或者在项目中初始化一个 git 或 hg 存储库。

    所以你应该创建一个空的.watchmanconfig 文件或 / 并使用 npm install 初始化你的文件夹

    【讨论】:

      猜你喜欢
      • 2017-01-02
      • 2021-04-03
      • 1970-01-01
      • 2021-04-17
      • 2012-08-02
      • 2013-12-10
      • 2013-07-14
      • 2019-10-30
      相关资源
      最近更新 更多