Alaa
Alaa

Reputation: 45

The module `./index` could not be found from Indeed

I've created a new project using react-native init 'project name' and everything is good, once I run the app using react-native run-android the app starts but gives me a redBox screen that shows an error:

Loading dependency graph, done. Error: Unable to resolve module ./index from C:\Users\Alaa\Documents\ReactNativeProjects\myProject\node_modules\react-native\scripts/.: The module ./index could not be found from C:\Users\Alaa\Documents\ReactNativeProjects\myProject\node_modules\react-native\scripts/.. Indeed, none of these files exist:

It tells me that the index.js file is not found but it is already there! Can you help me guys, I've been searching for this problem for about 1 day. I tried to clean the cache and install the npm again but didn't work. I tried to change the version too but didn't work.

Upvotes: 2

Views: 3129

Answers (7)

HannahCarney
HannahCarney

Reputation: 3631

I accidentally deleted my index.js file. Maybe it helps?

Upvotes: 0

pikamorfo
pikamorfo

Reputation: 31

I guys, but maybe a lot of people do not know the following:

First make sure that device is connected: adb devices

Open 2 cmd's windows (Windowskey+R [cmd]) and...

1) in First Window : react-native start -- --reset-cache

2) in Second Window : react-native run-android

Upvotes: 3

Rahul Rijhwani
Rahul Rijhwani

Reputation: 11

open terminal and run this code
'watchman watch-del-all && react-native start -- --reset-cache'

Upvotes: 1

Alaa
Alaa

Reputation: 45

I tried resetting cache and deleting node_modules files but didn't work with me. What worked with me is using 0.58.6 version when first creating the app (react-native init --version 0.58.6 name) solved my problem. Thanks, guys!

Upvotes: 0

hamza ajaz
hamza ajaz

Reputation: 1244

I was also getting the same problem. There is no problem with the react native version. My react native version is 0.59.1. I just solved it by using

npm start -- --reset-cache

Upvotes: 4

Maneesh
Maneesh

Reputation: 674

This is happening for latest version 0.59.1 I guess it is not stable. Stable version is 0.58.6. Better to create new project with that particular version as react-native init --version = "0.58.6" <Your App Name> .

Upvotes: -1

Nilesh Kadam
Nilesh Kadam

Reputation: 27

I was getting the same error. I just downgrade the react-native version to 0.58.6 and it works for me :)

Try to run following command and It might work.

> npm i [email protected] 

Upvotes: -1

Related Questions