神坑React Native之react-native-vector-icons组件报错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的解决方案

  • 2018-01-20
  • 949
  • 0

react native项目中使用了大名鼎鼎的图标组件 react-native-vector-icons组件,但是今天测试的时候红屏报错:

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

之前从来没遇到过这个错误,而且特意新建了新的react-native项目测试,问题依旧。去墙外搜索了一番,是react native最新版本(目前最新版是0.52)的问题,解决方法是:

删掉项目中这个文件 node_modules/react-native/local-cli/core/__fixtures__/files/package.json

参考链接:https://github.com/oblador/react-native-vector-icons/issues/626

感谢打赏!
微信
支付宝

评论

还没有任何评论,你来说两句吧