Cannot find entry file index.js with Expo XDE

2019-07-14 07:03发布

问题:

When I load my react-native app in Expo I get the error: "Cannot find entry file index.js in any of the roots."

I am adding onto an existing React Web App, and have index.ios.js at the root level. Everything works fine locally, in simulator and through Xcode on my phone hardwired. I've converted my app with exp convert and integrated all info into exp.json.

All info for the ios app is contained in a folder called "ios".

Has anyone run into this or have any thoughts on how to get unstuck?

回答1:

check you package.json and rename index.js to your entry file.

//...
},
  "main": "index.js"
}


回答2:

If you are using Expo, you need to go to your project folder and find the below file:

\node_modules\expo\AppEntry.js

import { KeepAwake, registerRootComponent } from 'expo';
import App from '../../App';

if (__DEV__) {
  KeepAwake.activate();
}

registerRootComponent(App);

and here just replace the App to Custom_Component_Name in the second line of import.