如何将 expo 项目弹出到本机代码 [英] How to eject expo project to native code

查看:51
本文介绍了如何将 expo 项目弹出到本机代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用命令 npm run eject 从 expo 中弹出项目.它生成 2 个文件夹 iosandroid.我试图通过 xcode 运行该项目,但它仍然显示此错误.可能我不清楚eject后如何运行项目,你能帮我运行一下吗?我运行了一些语句来安装 pod,但无法运行

解决方案

因此,对于弹出,您应该有两个选项:

<代码>?你想如何从 create-react-native-app 中弹出?(使用方向键)❯ React Native:我想要一个常规的 React Native 项目.ExpoKit:我将创建或使用 Expo 帐户登录以使用 React Native 和 Expo SDK.取消:我将继续我当前的项目结构.

如果您选择第一个 (React Native),那么打开 Xcode 项目并运行应用程序应该没有问题(也不会安装 Pod).由于您的错误和评论另有说明,我可以假设您选择了选项 2:Expokit.

为此,您应该会收到有关创建 Expo 帐户或使用现有帐户的提示:

<代码>?你想如何从 create-react-native-app 中弹出?React Native:我想要一个常规的 React Native 项目.❯ ExpoKit:我将创建或使用 Expo 帐户登录以使用 React Native 和 Expo SDK.取消:我将继续我当前的项目结构.需要一个世博帐户才能继续.?看来您已经以 ...

之后,您需要按照使用 ExpoKit 进行开发.特别是要让 iOS 运行,您需要遵循所有步骤 本节运行npm run eject后.

如果您已经完成了所有这些,那么在与 Expo XDEexp.我现在刚刚测试了两者,它可以正常工作.仔细检查您的步骤以确保您没有遗漏任何东西.否则,请编辑您的问题,详细说明您运行的命令、您拥有的其他依赖项等,因为我无法重现您遇到的错误.

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

解决方案

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.

这篇关于如何将 expo 项目弹出到本机代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆