React Native Error Fix: Error: Unable to resolve module `./index` from `\node_modules\react-native\scripts/.`

Last Updated on March 29, 2019.

I just created a new React Native project with the latest React Native version 0.59. Unfortunately, I stuck on a new react native error when I try to run the project using the command react-native run-android.

Here’s the React native error fix for Error: Unable to resolve module ./index from \node_modules\react-native\scripts/.: The module ./index could not be found from \node_modules\react-native\scripts/.. Indeed, none of these files exist.

There are three solutions for this:

Solution 1:
1. Run the command react-native start — –reset-cache
2. Open another terminal and run project using react-native run-android

Solution 2:
Update node_modules\react-native\scripts\launchPackager.bat file as given below.

@echo off
title Metro Bundler
call .packager.bat

:: delete this line
node "%~dp0..\cli.js" start 

:: Add this line
node "%~dp0..\cli.js" start --projectRoot ../../../ 


Solution 3:
Modify \node_modules\@react-native-community\cli\build\commands\runAndroid\runAndroid.js file as given below.

const procConfig = {

    // delete this line    
    cwd: scriptsDir

    // add this line
    cwd: process.cwd()

I hope any of the solutions will solve your React Native issue. If the issue still persists, then refer this GitHub issue.

2 thoughts on “React Native Error Fix: Error: Unable to resolve module `./index` from `\node_modules\react-native\scripts/.`”

  1. Thanks, it works! After re-installing my dev env, I saw the issue which I have not faced before。

Leave a Reply

%d bloggers like this: