1. 程式人生 > >【原】Cannot find entry file index.ios.js [index.android.js] in any of the roots

【原】Cannot find entry file index.ios.js [index.android.js] in any of the roots

今天在執行新的React Native專案時,出現了錯誤。
錯誤資訊如圖:

這裡寫圖片描述



stackoverflow上搜索了一下,發現很多人遇到過這個問題。React Native的github上也有相應的Issue#14246

於是參考大家的方法一一進行嘗試,如切換React Native版本,
使用npm start – –reset-cache命令重新啟動包管理器等。但都沒有奏效。

最後參考(在這裡再次感謝hmatijevic)的方法解決了問題,原來是安裝了watchman導致的。

將watchman解除安裝掉,問題得到了解決(具體原因,暫時還未深究)。

開啟資源管理器=》結束watchman程序=
》解除安裝watchman,並移除path環境變數中移除watchman的路徑。 重新執行react-native run-android/run-ios即可。

另外附一下我的機器環境:

OS: Windows 10
react-native-cli: 2.0.1
react-native: 0.47.1
node: 8.2.1
npm: 5.3.0