[英]How to fix Unable to resolve "react-native-screens" from "node_modules\react-navigation-stack\lib\module\views\StackView\StackViewCard.js"?
[英]Unable to resolve "react-native-paper/lib/typescript/src/components/MaterialCommunityIcon" from "screens\SignUpScreen.js"
我運行npm start
或expo start -c
以從空緩存開始,到目前為止一切順利,但是當我嘗試運行 android 模擬器時,出現以下錯誤
無法從“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon” 構建失敗 JavaScript 包。
我試過刪除 node_modules,更新 Expo SDK 其他幾個人也試過但到目前為止什么都沒有......
這是我的 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
}
有任何想法嗎?
我再次查看了我在SignUpScreen.js
上的導入,發現了這個導入:
import { accessibilityProps } from 'react-native-paper/lib/typescript/src/components/MaterialCommunityIcon';
導致問題的原因,將其刪除,現在一切正常。
也為我工作!
刪除:
import { black } from "react-native-paper/lib/typescript/src/styles/colors";
然后重新加載你的biuld。
我得到了同樣的錯誤,因為我使用了兩個 ui 的庫,它們都有共同的功能。 材質 UI 和 react-native-paper。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.