2017-03-03 34 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

它已經在我的項目的根文件夾。 –

相關問題