react-native run-android上的React Native错误
Posted
技术标签:
【中文标题】react-native run-android上的React Native错误【英文标题】:React Native error on react-native run-android 【发布时间】:2021-05-05 11:50:49 【问题描述】:我正在尝试运行一个 React Native 项目,它在 react-native run-android 上抛出以下错误。
我有一个版本为 0.60.4 的 RN 项目,要升级到版本 0.63.3 我创建了一个版本为 0.63.3 的新项目,并将旧项目 RN 版本 0.60.4 中的所有文件复制到版本为新的 RN 项目0.63.3.
完成上述步骤后,它会抛出以下错误。
谁能帮我解释一下为什么会出现这个问题。
以下是日志:
[Wed May 05 2021 17:04:41.331] WARN Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.332] WARN Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.332] WARN Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.333] WARN Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.334] WARN Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.334] WARN Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.334] WARN Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.335] WARN Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.335] WARN Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.336] WARN Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.336] WARN Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.337] WARN Require cycle: node_modules/react-native-paper/src/components/FAB/FAB.js -> node_modules/react-native-paper/src/components/FAB/FABGroup.js -> node_modules/react-native-paper/src/components/FAB/FAB.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.337] WARN Require cycle: node_modules/react-native-paper/src/components/Appbar/Appbar.js -> node_modules/react-native-paper/src/components/Appbar/AppbarHeader.js -> node_modules/react-native-paper/src/components/Appbar/Appbar.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.337] WARN Require cycle: node_modules/react-native-paper/src/components/ToggleButton/ToggleButton.js -> node_modules/react-native-paper/src/components/ToggleButton/ToggleButtonGroup.js -> node_modules/react-native-paper/src/components/ToggleButton/ToggleButton.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Wed May 05 2021 17:04:41.338] ERROR TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')
[Wed May 05 2021 17:04:41.338] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Wed May 05 2021 17:04:41.339] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
包.json
"name": "FunnyAppName",
"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":
"@yfuks/react-native-action-sheet": "^0.0.5",
"axios": "^0.19.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"native-base": "^2.13.4",
"prop-types": "^15.7.2",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-appstore-version-checker": "^3.0.0",
"react-native-check-box": "^2.1.7",
"react-native-check-version": "^1.0.8",
"react-native-complete-flatlist": "^1.1.34",
"react-native-countdown-component": "^2.5.2",
"react-native-country-picker-modal": "^2.0.0",
"react-native-device-info": "^2.3.2",
"react-native-document-picker": "^4.1.1",
"react-native-dropdown": "^0.0.6",
"react-native-dropdown-picker": "^3.7.8",
"react-native-easy-grid": "^0.2.1",
"react-native-elements": "^1.1.0",
"react-native-firebase": "^5.5.6",
"react-native-flip-toggle-button": "^1.0.9",
"react-native-floating-action": "^1.21.0",
"react-native-gesture-handler": "^1.3.0",
"react-native-hr": "^1.1.4",
"react-native-image-picker": "^1.0.2",
"react-native-loading-spinner-overlay": "^2.0.0",
"react-native-localization": "^2.1.5",
"react-native-material-dropdown": "^0.11.1",
"react-native-material-menu": "^1.1.3",
"react-native-modal": "^11.3.1",
"react-native-modal-datetime-picker": "^7.5.0",
"react-native-multiple-choice": "^0.0.8",
"react-native-multiple-select": "^0.5.3",
"react-native-multiple-select-list": "^1.0.4",
"react-native-paper": "^2.16.0",
"react-native-picker-select": "^6.3.0",
"react-native-razorpay": "^2.2.4",
"react-native-reanimated": "^2.1.0",
"react-native-render-html": "^5.0.0",
"react-native-screens": "^3.1.1",
"react-native-select-contact": "^1.2.1",
"react-native-select-multiple": "^2.0.0",
"react-native-selectme": "^1.2.3",
"react-native-simple-radio-button": "^2.7.3",
"react-native-simple-toast": "^1.1.3",
"react-native-sqlite-storage": "^5.0.0",
"react-native-table-component": "^1.2.0",
"react-native-textarea": "^1.0.3",
"react-native-vector-icons": "^7.0.0",
"react-native-version-check": "^3.4.2",
"react-native-version-info": "^1.1.0",
"react-native-view-more-text": "^2.1.0",
"react-native-web-swiper": "^1.16.2",
"react-native-webview": "^7.5.2",
"react-native-youtube": "^2.0.1",
"react-navigation": "^3.11.1",
"reactstrap": "^8.0.1",
"rn-fetch-blob": "^0.10.16",
"rn-multiple-choice": "^0.0.5",
"toggle-switch-react-native": "^2.0.0"
,
"devDependencies":
"@babel/core": "^7.14.0",
"@babel/runtime": "^7.14.0",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.25.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.0",
"react-test-renderer": "16.13.1"
,
"jest":
"preset": "react-native"
提前致谢。
【问题讨论】:
您的错误似乎与传递给<Animated.Text>
组件的样式道具有关,请提供您的组件代码,以便我们进一步提供帮助! - Mickaël Gagné。
【参考方案1】:
你可以使用
// import RNFetchBlob from '../index.js'
import NativeModules from 'react-native';
const RNFetchBlob = NativeModules.RNFetchBlob
【讨论】:
以上是关于react-native run-android上的React Native错误的主要内容,如果未能解决你的问题,请参考以下文章
react-native run-android 命令失败,但 gradlew installDebug 工作
react-native run-android 失败:无法在设备上安装应用程序,请阅读上面的错误
使 react-native run-android 命令在编译项目时不下载文件
React-native run-android 构建了我的应用程序的正确版本,但 assembleRelease/react-native run-android --variant=release