您好,我有这个错误弹出的所有时间:
类型错误:未定义不是位于node_modules/react-native/Libraries/Core/ExceptionsManager的函数(靠近..."(0,_reactNavigationTabs. createBottomTapNavigator)...")。js:104:6报告中的异常位于node_modules/react-native/Libraries/Core/ExceptionsManager。js:172:19处理中的异常位于node_modules/react-native/Libraries/Core/setUpErrorHandling。js:24:6处理中的错误位于node_modules/@react-native/polyfills/error-guard。js:49:36错误实用程序中的致命错误位于node_modules/metro-runtime/src/
固定违规:"main"尚未注册。这可能发生在以下情况:
- Metro(本地开发服务器)从错误的文件夹运行。请检查Metro是否正在运行,停止它并在当前项目中重新启动它。
- 由于发生错误,模块无法加载,并且未调用
AppRegistry.registerComponent
。位置:node_modules/react-native/Libraries/Core/ExceptionsManager. js:104:6报告中的异常位置:node_modules/react-native/Libraries/Core/ExceptionsManager. js:172:19处理中的异常位置:node_modules/react-native/Libraries/Core/setUpErrorHandling. js:24:6处理中的异常位置:node_modules/@react-native/polyfills/error-guard. js:49:36错误实用程序中的错误。报告致命错误
我的App.js看起来像这样:
import React from "react";
import { createAppContainer, createSwitchNavigator } from 'react-navigation'
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTapNavigator } from 'react-navigation-tabs';
import AccountScreen from "./src/screens/AccountScreen";
import SignInScreen from "./src/screens/SignInScreen";
import SignUpScreen from "./src/screens/SignUpScreen";
import TrackCreateScreen from "./src/screens/TrackCreateScreen";
import TrackDetailScreen from "./src/screens/TrackDetailScreen.js";
import TrackListScreen from "./src/screens/TrackListScreen";
const switchNavigator = createSwitchNavigator(
{
loginFLow: createStackNavigator({
SignUp: SignUpScreen,
SignIn: SignInScreen
}),
mainFlow: createBottomTapNavigator({
trackListFlow: createStackNavigator({
TrackList: TrackListScreen,
TrackDetail: TrackDetailScreen
}),
TrackCreate: TrackCreateScreen,
Account: AccountScreen
})
}
)
export default createAppContainer(switchNavigator)
这是我的包裹
{
"name": "tracks",
"version": "1.0.0",
"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.11",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/stack": "^6.1.1",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.2"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
我正在使用expo。这是由于过时的语法还是有人知道可能是什么问题?
我安装了所有的依赖项,并查看了文档,但没有发现任何东西
2条答案
按热度按时间gojuced71#
这是一个打字错误。应该是:
而不是:
yk9xbfzb2#
有许多不同的快取与您的项目相关联,可能会使您的项目无法如预期般执行。清除快取有时可协助您解决与过时或损毁数据相关的问题,而且在疑难排解和两柴时通常很有用。
使用此命令清除项目缓存:
您可以在此处阅读更多信息:
https://forums.expo.dev/t/how-to-clear-the-expo-and-react-native-packager-caches-metro-watchman-haste/1352