Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error While run react-native run-ios. Error: Cannot find module 'metro-config'

I am running React-native Project by terminal using react-native run-is command. I want to run it in simulator. first I run npm install ,then react-native run-ios. It showing error

Error: Cannot find module 'metro-config' Require stack: - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/util/Config.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/core/index.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cliEntry.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cli.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/cli.js - /usr/local/lib/node_modules/react-native-cli/index.js

like image 803
Deepti Raghav Avatar asked Jul 12 '26 15:07

Deepti Raghav


2 Answers

You seem to have no Metro-config module installed. Install this module.

npm i metro-config --save-dev
like image 172
hong developer Avatar answered Jul 15 '26 12:07

hong developer


Screenshot of react native 0.72 message

Add metro.config.js to your root project folder and add the following:

const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const config = {};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
like image 43
hamza ahmad Avatar answered Jul 15 '26 11:07

hamza ahmad