1. 程式人生 > >react-native-vector-icons報錯問題

react-native-vector-icons報錯問題

最近在寫專案的時候,在除錯程式碼的過程中,偶爾會報如下錯誤,想必好多同學都遇到了,現在記錄一下,和大家分享。

error: bundling failed: Error: While resolving module `react-native-vector-icons/dist/EvilIcons`, the Haste package `react-native-vector-icons` was found. However the module `dist/EvilIcons` could not be found within the package. Indeed, none of these files exist:

  * `/Users/user/Desktop/testapp/node_modules/react-native/local-cli/core/__fixtures__/files/dist/EvilIcons(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
  * `/Users/user/Desktop/testapp/node_modules/react-native/local-cli/core/__fixtures__/files/dist/EvilIcons/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`

解決問題第一大法,去github上找到這個專案的issues中,在
https://github.com/oblador/react-native-vector-icons/issues/626中看到了解決方案:
在專案的根目錄下,執行一下如下程式碼就OK了

rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json