How to eject expo project to native code

26,444

Solution 1

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.

Solution 2

If you want to download new project without expo then try run:

react-native init ProjectNameHere

or , If you want to convert your own project without expo then try :

 1. rm -rf node_modules
 2. remove expo dependencies from package.json
 3. npm install
 4. react-native upgrade

(Note:This following step will create new ios and android folder and you have to redo the dependencies. I was struggling with the same issue so I posted my solution)

Share:
26,444
Hoai Truong
Author by

Hoai Truong

Updated on July 21, 2022

Comments

  • Hoai Truong
    Hoai Truong almost 2 years

    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

  • Hoai Truong
    Hoai Truong about 6 years
    I did step by step and build succeed, but still have problems after running. Module RNGestureHandlerModule requires main queue setup since it overrides constantsToExport but doesn't implement `requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of. This is a message problem after build succeed
  • Michael Cheng
    Michael Cheng about 6 years
    @HoaiTruong Ok, so it works, but there's a second issue now? If that's the case, then either post a new question or edit this one and add what you are running into now (include errors, exactly what steps you've taken, and maybe your package.json file). Need to know so I understand what worked and what didn't so I don't go chasing the wrong assumptions. I'm about to sleep and will be very busy so I won't be able to check back for at least 2 days, but that info should be enough to get someone else to help.
  • Hoai Truong
    Hoai Truong about 6 years
    Some components from expo such as import { Font, AppLoading, Asset } from "expo". If eject the project, how these Components work?