0

I am getting this error when upgrade my react native.

It says

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:

Actually don't know how to solve. Can anyone help please. Thanks

The version I am currently using

"react": "^16.8.4", "react-native": "^0.59.0",

2

4 Answers 4

1

This linked solved my problem.

Though you will need to do this for every time you start a new project.. its an upgrade issue from react-native

Update node_modules\react-native\scripts\launchPackager.bat file. @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 ../../../ 

pause
exit

We are giving project root path to Metro instance here,

Or in \node_modules@react-native-community\cli\build\commands\runAndroid\runAndroid.js edit this, const procConfig = {

    // delete this line    
    cwd: scriptsDir

    // add this line
    cwd: process.cwd()
};
Sign up to request clarification or add additional context in comments.

1 Comment

in my case, i noticed it after an upgrade, in my react-native....with cwd:process.cwd() in my runAdriod.js file
0

Try removing everything from node_modules and then do npm install

cd node_modules
rm -rf *

cd ../
npm install 

1 Comment

Thanks for reply. I have clear the cache But no luck.
0

This is an issue in the latest upgrade of react-native version. Please downgrade your current it will work. I tried the same

Comments

0

Same exact problem I am facing too. I just updated to 0.59.1 and this isn't working... As a work around, I am running the metro builder in a separate tab, and then running react in a separate tab.

react-native start --reset-cache in one terminal and left it open react-native run-android in another terminal

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.