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.
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.
Share Improve this question asked Mar 24, 2019 at 16:08 AlaaAlaa 452 silver badges9 bronze badges 1-
it is not an issue with
0.59.1
. If you upgraded from older version of React Native, there some major changes in files and that is why you will get that error. Please see rn-diff-purge – Ziyo Commented Mar 25, 2019 at 1:50
7 Answers
Reset to default 4I 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
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
open terminal and run this code
'watchman watch-del-all && react-native start -- --reset-cache'
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!
I accidentally deleted my index.js file. Maybe it helps?
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 mand and It might work.
> npm i [email protected]
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>
.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744897374a4599776.html
评论列表(0条)