react-native run-android 時,報如下錯誤:
error:?bundling?failed:?Error:?While?resolving?module?`react-native-vector-icons/MaterialIcons`,?the?Haste?package?`react-native-vector-icons`?was?found.?However?the?module?`MaterialIcons`?could?not?be?found?within?the?package.?Indeed,?none?of?these?files?exist: ?*?`/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)` ??*?`/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
google了下,在網(wǎng)上找到了。
原因可能是React-Native,React,React-native-vector-icons的版本問題。
解決方法:刪除這個文件,刪前記得備份。
./node_modules/react-native/local-cli/core/__fixtures__/files/package.json