typescript - React Native - 不变违规:模块 AppRegistry 不是注册的可调用模块(调用 runApplication)
问题描述
从昨天开始,我已经开始收到此错误Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication),我的应用程序正在工作,但它突然坏了。
谷歌几个小时他们中的大多数人要求 - 删除您的 yarn.lock/package-json.lock 文件并运行 yarn/npm install。然后尝试使用 npx react-native start --reset-cache 清除缓存,但没有一个有效。
尝试删除重新构建应用程序,但失败并出现相同的错误。
我的 - index.js
/**
- @格式 */
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
反应原生版本
"react": "16.13.1",
"react-native": "0.63.2",
我所有的依赖项是
包.json
"dependencies": {
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-community/datetimepicker": "^2.6.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/picker": "^1.6.5",
"@react-native-community/slider": "^3.0.3",
"@react-navigation/bottom-tabs": "^5.7.2",
"@react-navigation/material-top-tabs": "^5.2.14",
"@react-navigation/native": "^5.7.2",
"@react-navigation/stack": "^5.8.0",
"@types/react-native-svg-charts": "^5.0.3",
"@types/react-redux": "^7.1.9",
"lottie-ios": "3.1.8",
"lottie-react-native": "^3.5.0",
"moment": "^2.27.0",
"react": "16.13.1",
"react-moment": "^0.9.7",
"react-native": "0.63.2",
"react-native-gesture-handler": "^1.7.0",
"react-native-reanimated": "^1.10.1",
"react-native-safe-area-context": "^3.1.1",
"react-native-screens": "^2.9.0",
"react-native-svg": "^12.1.0",
"react-native-svg-charts": "^5.4.0",
"react-native-swipe-list-view": "^3.2.3",
"react-native-swiper": "^1.6.0",
"react-native-tab-view": "^2.15.0",
"react-redux": "^7.2.1",
"redux": "^4.0.5"
}
解决方案
它发生在我身上,当我使用时:
import { createStackNavigator } from 'react-navigation-stack'
通过将其替换为以下内容解决了该问题:
import { createStackNavigator } from "@react-navigation/stack";
推荐阅读
- ruby-on-rails - Rails ActionCable - 监听或订阅后台进程
- keras - keras 中的 LSTM 实时预测
- android - 如果在 onRestart() 之后调用 onStart(),是否在 onStart() 之前调用 onCreate()?
- c - FreeRTOS LPUART:从 uart 接收时缺少数据
- stream - HIDDevice 流似乎在 Telegramm / HIDSharp 中找不到正确的条目位置
- caching - Web 缓存是否代表 Web 应用程序分析的问题?
- python - 在 Flask 和 FastAPI 应用程序之间共享相同的模型和数据库会话
- saxon - XdmNode.Children(uri, localname) 不返回结果
- node.js - 从 node/express 中的变量设置环境
- powerbi - PowerBI:如何按升序对x轴进行排序