2017-03-03 98 views
4

我学习react-native编程开发Android应用程序。在运行时运行应用程序时出现错误unable to resolve module。我找到了一些链接,并建议运行此命令react-native start --reset-cache,而这又需要系统上的watchman。我安装watchman那么我之后无法启动react-native错误:在柝路径找不到在Windows

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命令则发生

enter image description here

enter image description here

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

PATH是d:\阵营本地\例1 \ ExampleOne \ node_modules \守望

我不知道这可能是这个问题的原因。我的路径是错误的还是我指向错误的目录watchman?任何人都可以建议我如何解决这个问题。在此先感谢

回答

1

你可以简单地得到来自这个问题排除通过卸载watchman NPM包。尝试在全球范围内将其卸载,并在本地npm uninstall -g watchmannpm uninstall watchman

+0

嗨@TGMCians,该解决方案使“反应本土起步”能够运行,但运行时“反应原生运行Android的,我得到了一个错误说:EPERM:不允许操作,...,红色模拟器的错误屏幕显示:无法获得BatchedBridge,请确保您的包已正确打包。我使用Windows 7 btw,你有什么想法吗?谢谢! – VincentZHANG

+0

你可以试试这个https://stackoverflow.com/a/43217182/1741671 –

+0

谢谢你的回复,TGMCians,它没有解决问题,但是cmd中的错误信息没有了,唯一的问题是红色屏幕仍然显示:'无法获得BatchedBridge,请确保您的包已正确打包',我正在考虑是否应该安装守望者。你说什么? – VincentZHANG

1

通常当更夫没有运行出现这种情况。在项目的根文件夹中创建一个空的.watchmanconfig文件或在项目中初始化git或hg存储库。

所以你应该创建一个空.watchmanconfig文件或/和初始化安装与NPM您的文件夹

+0

它已经在我的项目的根文件夹。 –

相关问题