我不知道为什么我会收到此错误:
Unable to resolve module `@expo/vector-icons` from `...(directory path here)...` : Module does not exist in the module pack
我在其他论坛/网站上尝试了以下建议:
的package.json
{
"name": "app name",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"private": true,
"main": "node_modules/expo/AppEntry.js",
"dependencies": {
"babel-plugin-module-resolver": "^2.5.0",
"babel-preset-expo": "^4.0.0",
"expo": "^21.0.0",
"firebase": "^4.5.1",
"geofire": "^4.1.2",
"moment": "^2.19.1",
"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
"react-navigation": "^1.0.0-beta.13"
}
}
但仍然没有,仍然会收到此错误
答案 0 :(得分:2)
vector-icons
之类的声音是您应该在package.json
(https://www.npmjs.com/package/@expo/vector-icons)声明的另一个图书馆
答案 1 :(得分:1)
我通过此命令npm install @expo/vector-icons --save
答案 2 :(得分:1)
我遇到了同样的问题。这是babel-preset-expo。卸载并执行以下操作
npm i metro-react-native-babel-preset --save-dev
删除babel.config.json并创建一个名为.babelrc的新文件
然后指定预设
{
"presets": ["module:metro-react-native-babel-preset"]
}
答案 3 :(得分:0)
命令npm install @expo/vector-icons --save
可以解决问题!