2

After doing averything according to https://facebook.github.io/react-native/docs/getting-started , with an android studio emulator, and creating a template app with "react-native init myApp", i get this error:

Error: Unable to resolve module `./index` from `C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\react-native\scripts/.`: The module `./index` could not be found from `C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\react-native\scripts/.`. Indeed, none of these files exist:
  * `C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\react-native\scripts\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\react-native\scripts\index\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
    at ModuleResolver.resolveDependency (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\node-haste\DependencyGraph.js:283:16)
    at C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\lib\transformHelpers.js:261:42
    at Server.<anonymous> (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\Server.js:1038:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\Server.js:99:24)
    at _next (C:\Users\Oleg\Desktop\progStuff\SSFD2\node_modules\metro\src\Server.js:119:9)
::ffff:127.0.0.1 - - [24/Mar/2019:08:18:16 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"

Out of all the things i tried, including re-initializing the project, re-checking that i have everything installed and up-to-date, reinstalling some stuff, the only one that worked was using 0.58.6 version of react-native, it works fine. But i don't like that solution and want to use the latest version.

4 Answers 4

1

This is a issue by react-native and has just been fixed in a pending release. Run react-native start is one tab and run react-native run-android in another tab can fix it temporary (or downgrade to [email protected]).

https://github.com/facebook/react-native/issues/24112

Looks like this issue is only for the automatically launched packager as part of react-native run-android - if you run react-native start separately before run-android you should be good for now.

Update:

react-native v0.59.2 fixed this issue on iOS but still not working for android yet. Now you need to run react-native start --reset-cache and react-native run-android in two terminals.

Update2:

https://github.com/facebook/react-native/issues/24112#issuecomment-477069406

Follow this link to modify launchPackager.bat seems to the temporary workaround for Windows users.

Sign up to request clarification or add additional context in comments.

2 Comments

Oh, so thats a known thing? Alright, i'll try that out in a few days when i get back to the PC with the setup and check if that solution works. Thanks!
The last solution, on that github link, worked for me. Thanks a lot!
1

Use the following:

react-native start --reset-cache

Comments

0

Error is stating that, it is not able to find the module react-native dependency from the node_modules. You should probably

try deleting the node modules

and run npm install again.

Comments

0

Clean your cache:

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

Restart packager:

react-native start

Now run your app:

react-native run-android or react-native run-ios

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.