简体   繁体   English

无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon”

[英]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 startexpo 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.

相关问题 如何修复无法从“node_modules\\react-navigation-stack\\lib\\module\\views\\StackView\\StackViewCard.js”解析“react-native-screens”? - How to fix Unable to resolve "react-native-screens" from "node_modules\react-navigation-stack\lib\module\views\StackView\StackViewCard.js"? React Native react-native-paper 按钮具有更大的高度 - React native react-native-paper button with greater height 无法从 `node_modules\react-redux\lib\connect\mapDispatchToProps.js` 解析模块 `../../../../src/redux` - Unable to resolve module `../../../../src/redux` from `node_modules\react-redux\lib\connect\mapDispatchToProps.js` react native:Searchbar的背景(react-native-paper) - react native: background of Searchbar (react-native-paper) 如何将 css 应用于<text>内部组件<card.content> react-native-paper 中的组件?</card.content></text> - How to apply css to the <Text> component inside <Card.Content> component from react-native-paper? React-Native-Paper 主题不会使用自定义字体 - React-Native-Paper Theme won't use Custom Fonts ZIndex 仅与 Android 中的任何 react-native-paper 组件重叠 - ZIndex overlapping with any react-native-paper component in Android only 未聚焦时更改边框线 colors (react-native-paper) - Change border line colors when unfocused (react-native-paper) 如何在 react-native-paper 中使图标旋转? - How to make icon spin in react-native-paper? 减少 react-native-paper TextInput 的高度和垂直填充 - Reduce height and vertical padding for a react-native-paper TextInput
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM