反应本地实质性捆绑误差



我已经安装了我的项目并链接了反应 - 矢量辅助。我正在使用Android模拟器在Mac上测试。

这是我的导入:

import Icon from 'react-native-vector-icons/MaterialIcons';

这就是我的使用方式:

<Icon name='more vert' size={20} color='#24572c'/>

当我尝试构建此错误时。不知道为什么或如何处理。

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/Alia/Desktop/GroceriesApp/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
  * `/Users/Alia/Desktop/GroceriesApp/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
    at MissingFileInHastePackageError (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:400:5)
    at resolveHasteName (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:385:9)
    at ModuleResolver._resolveDependency (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:315:37)
    at ModuleResolver.resolveDependency (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:877)
    at ResolutionRequest.resolveDependency (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16)
    at DependencyGraph.resolveDependency (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352)
    at /Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36
    at next (native)
    at step (/Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306)
    at /Users/Alia/Desktop/GroceriesApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536

我会定期得到此错误。基于GitHub上的此线程,您可以运行

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

后词,重新启动包装器。这经常发生在我身上,并且每次都与反应原型元素一起工作。

相关内容

  • 没有找到相关文章

最新更新