How to eject expo project to native code

Hoai Truong picture Hoai Truong · Feb 17, 2018 · Viewed 21.5k times · Source

I eject project from expo with command npm run eject. It generates 2 folders ios and android. I tried to run the project by xcode but it still display this error. Maybe I'm not clear how to run project after eject, can you help me run it. I run some statements to install pod, but cannot work https://github.com/CocoaPods/CocoaPods/issues/2303

enter image description here

Answer

Michael Cheng picture Michael Cheng · Feb 18, 2018

So with ejecting, you should have been presented with two options:

? How would you like to eject from create-react-native-app? (Use arrow keys)
❯ React Native: I'd like a regular React Native project. 
  ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK. 
  Cancel: I'll continue with my current project structure. 

If you chose the first (React Native), then there should have been no issues with opening up your Xcode project and running the app (there would also be no pods to install). Since your error and comment indicates otherwise, I can presume that you chose option 2: Expokit.

For that, you should have been prompted with something about making an Expo account or using an existing one:

? How would you like to eject from create-react-native-app? 
  React Native: I'd like a regular React Native project. 
❯ ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK. 
  Cancel: I'll continue with my current project structure.

  An Expo account is required to proceed.
? It appears you're already logged in to Expo as ...

After that, you'll need to follow the steps in Developing With ExpoKit. Specifically to get iOS running, you need follow all of the steps in this section after running npm run eject.

If you've done all of that, then it should work fine when running in conjunction with Expo XDE or exp. I've just tested both right now and it works without error. Double check your steps to make sure you didn't miss something. Otherwise, please edit your question with more details on exactly what commands you ran, what other dependencies you have, etc. as I'm unable to reproduce the error you have.