Error cannot find module ‘@react-native/metro-config’

Error: Cannot find module ‘@react-native/metro-config’

This error usually occurs when the required module ‘@react-native/metro-config’ is missing from your project’s dependencies or it is not installed correctly. Here’s how you can fix it:

  1. Make sure you have declared ‘@react-native/metro-config’ as a dependency in your project’s package.json file. If it is not listed, you can add it manually by running the following command in your project’s root directory:

    npm install --save-dev @react-native/metro-config

    or

    yarn add --dev @react-native/metro-config
  2. If the module is already present in your package.json file, it’s possible that it was not installed correctly. In this case, you can try removing the node_modules folder and reinstalling the dependencies. Run the following commands:

    rm -rf node_modules
    npm install

    or

    yarn install
  3. Once the installation is complete, try running your project again to see if the error has been resolved.

Read more

Leave a comment