Module AppRegistry is not a registered callable module React Native

I am struggling with this problem I did everything with react native docs but I don’t have any idea whats wrong

Here is App.js

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';



function HomeScreen() {
 return (
  <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
  <Text>Home Screen</Text>
  </View>
 );
 }

 const Stack = createStackNavigator();

 function App() {
 return (
<NavigationContainer>
  <Stack.Navigator>
    <Stack.Screen name="Home" component={HomeScreen} />
  </Stack.Navigator>
</NavigationContainer>
  );
 }

 export default App;

I have already tried reset cache. its my second time failing application

The bug :

*Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

Source: React Router Questions