首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在项目中找不到react-native-vector-icons/AntDesign -Android

在项目中找不到react-native-vector-icons/AntDesign -Android
EN

Stack Overflow用户
提问于 2020-02-27 16:32:12
回答 1查看 1.1K关注 0票数 0

我正面临着以下问题。

代码语言:javascript
复制
Error: Unable to resolve module `react-native-vector-icons/AntDesign` from `node_modules/react-native-elements/src/helpers/getIconType.js`: react-native-vector-icons/AntDesign could not be found within the project.

Package.json

代码语言:javascript
复制
{
  "name": "GeoLocation",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/geolocation": "^2.0.2",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-elements": "^1.2.7",
    "react-native-fused-location": "^1.1.1",
    "react-native-get-location": "^1.4.2",
    "react-native-vector-icons": "^4.6.0"
  },
  "devDependencies": {
    "@babel/core": "7.8.4",
    "@babel/runtime": "7.8.4",
    "@react-native-community/eslint-config": "0.0.5",
    "babel-jest": "24.9.0",
    "eslint": "6.8.0",
    "jest": "24.9.0",
    "metro-react-native-babel-preset": "0.56.4",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

我已经完成了以下链接中提到的所有步骤。

Unable to resolve module 'react-native-vector-icons/AntDesign''

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-27 17:42:13

我已经看过你的代码,我想告诉你,首先你应该编辑你的package.json并将react-native-vector-icons版本"react-native-vector-icons": "^4.6.0",升级到"react-native-vector-icons": "^6.6.0",,然后删除你的节点模块文件夹,然后运行npm安装命令,然后在你的文件中导入矢量图标,如下所示:-

代码语言:javascript
复制
import AntDesign from "react-native-vector-icons/AntDesign"

如果你仍然面临任何问题,请随时再问一次。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60429130

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档