[英]Unable to resolve "react-native-paper/lib/typescript/src/components/MaterialCommunityIcon" from "screens\SignUpScreen.js"
I run npm start
or expo start -c
to start with an empty cache and so far so good, but then when I tried to run the android simulator I get the error below我运行
npm start
或expo start -c
以从空缓存开始,到目前为止一切顺利,但是当我尝试运行 android 模拟器时,出现以下错误
Unable to resolve "react-native-paper/lib/typescript/src/components/MaterialCommunityIcon" from "screens\SignUpScreen.js" Failed building JavaScript bundle.无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon” 构建失败 JavaScript 包。
I've tried deleting the node_modules, updating Expo SDK as several others tried too but nothing so far...我试过删除 node_modules,更新 Expo SDK 其他几个人也试过但到目前为止什么都没有......
Here's my package.json这是我的 package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "0.1.6",
"@react-navigation/material-bottom-tabs": "^5.2.2",
"expo": "^37.0.0",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-elements": "^2.0.0",
"react-native-gesture-handler": "~1.6.0",
"react-native-paper": "^3.10.1",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "0.7.3",
"react-native-screens": "~2.2.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.3.9",
"react-navigation-stack": "^2.5.1"
},
"devDependencies": {
"babel-preset-expo": "^8.1.0",
"@babel/core": "^7.8.6"
},
"private": true
}
Any ideas?有任何想法吗?
I took a second look at my imports on SignUpScreen.js
and found this import:我再次查看了我在
SignUpScreen.js
上的导入,发现了这个导入:
import { accessibilityProps } from 'react-native-paper/lib/typescript/src/components/MaterialCommunityIcon';
Which was causing the issue, removed it and now everything works.导致问题的原因,将其删除,现在一切正常。
Worked for me too!也为我工作!
Removing:删除:
import { black } from "react-native-paper/lib/typescript/src/styles/colors";
and then reload your biuld.然后重新加载你的biuld。
I got the same error because I was using two ui's libraries both of them has common functions.我得到了同样的错误,因为我使用了两个 ui 的库,它们都有共同的功能。 material UI and react-native-paper.
材质 UI 和 react-native-paper。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.