Error: Watchman was not found in PATH in windows

Error: Watchman was not found in PATH in windows

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

react-native start

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 目录?谁能建议我如何解决这个问题。提前致谢

通常当守望者不在时会发生这种情况 运行。在项目的根文件夹中创建一个空 .watchmanconfig 文件或在项目中初始化 git 或 hg 存储库。

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

初始化你的文件夹

您可以通过卸载 watchman npm 包简单地解决这个问题。尝试全局和本地卸载它npm uninstall -g watchman npm uninstall watchman