Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29428

React Native Error: Unable to resolve module `./index` from `` - multiple issues

$
0
0

I use this boilerplate. I nearly got React Native working on my Android device. But somehow it fails in the last step because it does not find an index.js file. But that file is located in my project.

project structure

So when I now run this in src/

yarn react-native run-android

this is the Node CLI window:

node cli window

So my issue is:

Error: Unable to resolve module `./index` from ``:None of these files exist:  * index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

From the console itself I cannot see any issue:

terminal command

So somehow it does not find the index.js file for some reason.

I already tried yarn react-native start -- --reset-cache but it did not change anything.

Edit #1:

When I add a fake empty index.js file on root folder, the error is gone and in the emulator I get this one:

enter image description here

Edit #2:

I'm getting nearer to a solution. I just added this to the fake index.js in the root:

import {AppRegistry} from 'react-native';import App from './src/components/App';import {name as appName} from './src/app.json';AppRegistry.registerComponent(appName, () => App);

and there I got:

enter image description here

Edit #3:

Now it helped me to overwrite the app.json with the following:

{"name": "test","displayName": "test"}

and new error is:

enter image description here


Viewing all articles
Browse latest Browse all 29428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>