我正在学习react-native
编程来开发android应用程序。在运行时运行应用程序时,我收到了一些错误unable to resolve module
。我找到了一些链接,并建议运行此命令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 \示例1 \ ExampleOne \ node_modules \ watchman
我不确定这个问题的原因是什么。我的路径是错的还是指向watchman
的错误目录?任何人都可以建议我如何解决这个问题。提前致谢
答案 0 :(得分:1)
通常,当守望者没有跑步时会发生这种情况。在项目的根文件夹中创建一个空.watchmanconfig
文件,或者在项目中初始化git或hg存储库。
所以你应该创建一个空的.watchmanconfig
文件或/并用npm install初始化你的文件夹
答案 1 :(得分:1)
您可以通过卸载watchman
npm包来摆脱这个问题。尝试全局和本地npm uninstall -g watchman
npm uninstall watchman