react-nativeexpouninstallation

Failed to resolve plugin on an uninstalled package


I have tried to delete the expo-router dependency of my project

i used npm uninstall --save expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar react-native-gesture-handler to uninstall all the packages i have installed when first setting it up

the package got removed and isnt visible anymore in the package.json file

after the issue persisted i tried to use this since there were some changes with expo and the use of npx for the now deprecated expo cli:

npx expo uninstall expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar react-native-gesture-handler

when i tried this i got this issue Invalid project root: C:\Users\Tim\Desktop\Projects\Medical Journal App\MedicalJournal\uninstall

When i next wanted to uninstall it this wayi got this error:

PluginError: Failed to resolve plugin for module "expo-router" relative to "C:\Users\Tim\Desktop\Projects\Medical Journal App\MedicalJournal"

the plugin should've been uninstalled and not on the system anymore

You can find the entire stacktree here: https://pastebin.com/uqW5KuU0

I am using expo version 49.0.5 react 18.2.0 react-native 0.72.3

I switched to react navigation since i had an issue with expo-router

i have set up two code files none of which reference the expo-router package

I am using two code files

Home.js

import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
    
export default function HomePage() {
return(
    <View style={styles.container}>
      <Text>This works!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});


App.js

import { StyleSheet, Text, View, Pressable } from 'react-native';
import { HomePage } from './Pages/Home';

export default function App() {
  return (
  <View style={styles.container}>
    <Text>Test!</Text>
    <StatusBar style="auto" />
  </View>
    );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

I have tried restarting the temrinal, ide and the android emulator multiple times I have ensured im in the same directory i have installed the package installed in originally


Solution

  • It seems like there might be some residual configuration or cache causing the issue. When facing such issues, always try to following steps:

    1. Clear the cache

      npm cache clean --force

    2. Delete the node_modules folder and run

      yarn install or

      npm install

    These commands will reinstall packages and create a new node_modules folder.

    Restart the server, it should solve your problem. One last thing you can do is to check app.json or app.config.json for any references of any of the listed modules you installed.