【问题标题】:Unable to resolve module 'react-native-vector-icons/AntDesign''无法解析模块“react-native-vector-icons/AntDesign”
【发布时间】:2020-02-01 09:01:54
【问题描述】:

导入时遇到以下问题:

从“react-native-vector-icons/AntDesign”导入图标;

错误:

错误:捆绑失败:错误:无法从 /Desktop/development/cbcvp-rn/cbcvp/node_modules/react-native-elements/src/helpers/getIconType.js 解析模块 react-native-vector-icons/AntDesign:模块 react-native-vector-icons/AntDesign 在 Haste 模块映射中不存在

这可能与https://github.com/facebook/react-native/issues/4968有关 要解决,请尝试以下操作: 1.清除守望者手表:watchman watch-del-all。 2、删除node_modules文件夹:rm -rf node_modules && npm install。 3. 重置 Metro Bundler 缓存:rm -rf /tmp/metro-bundler-cache-*npm start -- --reset-cache。 4. 移除急速缓存:rm -rf /tmp/haste-map-react-native-packager-*。 在 ModuleResolver.resolveDependency (/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:161:1460) 在 ResolutionRequest.resolveDependency (/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:91:16) 在 DependencyGraph.resolveDependency (/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579) 在 dependencies.map.relativePath (/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19) 在 Array.map() 在 resolveDependencies (/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16) 在 /Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33 在 Generator.next () 在步骤(/Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313) 在 /Users/amit/Desktop/development/cbcvp-rn/cbcvp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473 BUNDLE [ios, dev] ./index.js ▓▓▓▓▓▓░░░░░░░░░░ 38.0% (719/1166),失败。

如何解决这个错误任何人帮助我...

谢谢

【问题讨论】:

  • 问题解决了吗?我遇到了同样的问题

标签: ios reactjs react-native


【解决方案1】:

反应原生链接

npm i react-native-vector-icons
npx react-native link react-native-vector-icons

链接时;错误找不到包。你确定这是一个 React Native 项目吗?

错误 EPERM:不允许操作,scandir 'E://android/app/build/intermediates/signing_config/debug/out/signing-config.json'。使用 --verbose 标志运行 CLI 以获取更多详细信息。

我遇到这个问题好几个小时了,但我发现它很晚。在我的最后这是一个愚蠢的错误。解决方案是以管理员身份运行 cmd

npx react-native link react-native-vector-icons

并且成功资产已成功链接到您的项目

【讨论】:

    【解决方案2】:

    运行以下命令

    npm i react-native-vector-icons
    npx react-native link react-native-vector-icons
    

    希望对你有帮助。

    【讨论】:

      【解决方案3】:

      纱线添加 react-native-vector-icons
      react-native 链接 react-native-vector-icons
      希望对你有用

      【讨论】:

        【解决方案4】:

        如果没有使用 react-native-link 链接你的库。还可以尝试清除缓存并重新启动 Metro Bundler。这有时会在安装任何库后发生。请让我知道它是否有效。谢谢

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-03-25
          • 2019-05-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-11-24
          • 2017-10-11
          • 2016-03-23
          相关资源
          最近更新 更多