react-native run-android 上的 React Native 错误
2021-05-05
3363
我正在尝试运行 React Native 项目,但它在 react-native run-android 上抛出了以下错误。
我有一个版本 0.60.4 的 RN 项目,为了升级到版本 0.63.3,我创建了一个版本 0.63.3 的新项目,并将所有文件从旧项目 RN 版本 0.60.4 复制到版本 0.63.3 的新 RN 项目。
完成上述步骤后,它抛出了以下错误。
有人可以帮我解决为什么会出现此问题吗?
以下是日志:
[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)
Package.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"
}
}
提前致谢。
2个回答
您可以使用
// import RNFetchBlob from '../index.js'
import {NativeModules} from 'react-native';
const RNFetchBlob = NativeModules.RNFetchBlob
Dyego Tavares Lima
2021-07-19
此问题已在 Github 页面 上修复。您需要删除或注释掉 import 行
// import RNFetchBlob from 'rn-fetch-blob';
之后,您需要从 react-native 导入 NativeModules,并使用 NativeModules 调用该包
const RNFetchBlob = NativeModules.RNFetchBlob;
Sachin Saini
2022-08-26