This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
create-expo-app
用于创建新 Expo 和 React Native 项目的命令行工具。
create-expo-app 是一个命令行工具,用于创建和设置新的 Expo 和 React Native 项目。该工具通过提供各种模板简化了初始化过程,使用户可以快速开始,而无需手动配置。
创建新项目
🌐 Create a new project
要创建新项目,请运行以下命令:
🌐 To create a new project, run the following command:
运行上述命令会提示你输入项目的应用名称。这个应用名称也会在应用配置的 name 属性中使用。
🌐 Running the above command will prompt you to enter the app name of your project. This app name is also used in the app config's name property.
选项
🌐 Options
使用以下选项自定义命令行为。
🌐 Uses the following options to customize the command behavior.
--yes
使用默认选项创建新项目。
🌐 Uses the default options to create a new project.
--no-install
跳过安装 npm 依赖或 CocoaPods。
🌐 Skips installing npm dependencies or CocoaPods.
--no-agents-md
跳过生成 AGENTS.md 和 .claude/settings.json。默认情况下,create-expo-app 会生成 AGENTS.md,让 AI 编程代理拥有 Expo 相关的上下文。当安装 Claude Code 时,它还会生成 .claude/settings.json,用来自动配置 expo 技能插件。生成的 AGENTS.md 会指向与你项目 SDK 版本匹配的 Expo 版本化文档。
🌐 Skips generating AGENTS.md and .claude/settings.json. By default, create-expo-app generates AGENTS.md so AI coding agents have Expo-specific context. When Claude Code is installed, it also generates .claude/settings.json to configure the expo skills plugin automatically. The generated AGENTS.md points to the versioned Expo docs matching your project's SDK version.
--template
使用 Node 包管理器 运行 create-expo-app 会用默认模板初始化并设置一个新的 Expo 项目。
🌐 Running create-expo-app with a Node package manager initializes and sets up a new Expo project using the default template.
你可以使用 --template 选项来选择以下模板之一,或者将其作为参数传递给该选项。例如,--template default。
🌐 You can use the --template option to select one of the following templates or pass it as an argument to the option. For example, --template default.
信息 想要更多模板?请查看
--example选项,通过其中的示例应用初始化你的项目,这些示例展示了特定的功能和集成。
--example
使用此选项可使用来自 expo/examples 的示例初始化项目。
🌐 Use this option to initialize a project using an example from expo/examples.
例如:
🌐 For example:
- 运行
npx create-expo-app --example会显示一个可供选择的可用示例交互列表 - 运行
npx create-expo-app --example with-router会使用 Expo Router 库设置一个项目 - 运行
npx create-expo-app --example with-react-navigation会创建一个类似默认模板的项目,但配置为使用纯 React Navigation 库
AI代理的 Expo 技能
🌐 Expo Skills for AI agents
如果你使用 AI 代理,请安装 Expo Skills 来教它来自示例库的标准模式:
🌐 If you use an AI agent, install Expo Skills to teach it the canonical patterns from the examples repository:
Expo's official example projects - the expo/examples repo of ~70 with-* integrations (Stripe, Clerk, Supabase, OpenAI, maps, Reanimated, SQLite, Skia, NativeWind, and more).
--version
打印版本号并退出。
🌐 Prints the version number and exits.
--help
打印可用选项列表并退出。
🌐 Prints the list of available options and exits.
节点包管理器支持
🌐 Node package managers support
使用 create-expo-app 创建新项目也会处理为特定 Node 包管理器设置所需的额外配置。
🌐 Creating a new project with create-expo-app also handles setting up additional configuration needed for a specific Node package manager.
如果你正在从一个包管理器迁移到另一个包管理器,你需要在项目中手动进行额外的配置。如果你正在使用 EAS,你还需要手动为项目配置任何额外所需的步骤。
每个包管理器的所有其他步骤都列在下面。
🌐 All the additional steps for each package manager are listed below.
npm
本地安装
🌐 Local installation
npm 是作为 Node.js 安装的一部分安装的。有关安装说明,请参阅 Node.js 文档。
🌐 npm is installed as part of Node.js installation. See Node.js documentation for installation instructions.
EAS 安装
🌐 EAS installation
如果项目目录包含 package-lock.json,则默认支持。
🌐 Supported by default if the project directory contains package-lock.json.
Yarn 1(经典)
🌐 Yarn 1 (Classic)
本地安装
🌐 Local installation
Yarn 1(经典版)通常作为 npm 的全局依赖安装。有关安装说明,请参阅 Yarn 1 文档。
🌐 Yarn 1 (Classic) is usually installed as a global dependency of npm. See Yarn 1 documentation for installation instructions.
EAS 安装
🌐 EAS installation
如果项目目录包含 yarn.lock,则默认支持。
🌐 Supported by default if the project directory contains yarn.lock.
Yarn 2+ (Modern)
本地安装
🌐 Local installation
请参阅 Yarn 文档 获取安装说明。
🌐 See Yarn documentation for installation instructions.
Yarn 2 及以上版本的包管理方式与 Yarn 1 不同。Yarn 2 及以上版本的核心变化之一是 Plug'n'Play (PnP) 节点链接模型,但它与 React Native 不兼容。
🌐 Yarn 2+ handles package management differently than Yarn 1. One of the core changes in Yarn 2+ is the Plug'n'Play (PnP) node linking model that does not work with React Native.
默认情况下,使用 create-expo-app 和 Yarn 2+ 创建的项目会使用 nodeLinker 并将其值设置为 node-modules 来安装依赖。
🌐 By default, a project created with create-expo-app and Yarn 2+ uses nodeLinker with its value set to node-modules to install dependencies.
EAS 安装
🌐 EAS installation
在 EAS 上使用现代 Yarn 需要在构建中启用 Corepack。在 eas.json 的构建配置中将 corepack 设置为 true:
🌐 Yarn Modern on EAS requires enabling Corepack for the build. Set corepack to true in your build profile in eas.json:
然后,在你项目的 package.json 中使用 packageManager 字段固定 Yarn 版本。在本地运行 yarn set version <version> 会为你更新此字段:
🌐 Then, pin the Yarn version in your project's package.json using the packageManager field. Running yarn set version <version> locally will update this field for you:
在添加上述两种配置后,当 EAS 安装依赖时,Corepack 会自动下载并使用固定的 Yarn 版本。
🌐 After adding both of the above configurations, Corepack automatically downloads and uses the pinned Yarn version when EAS installs dependencies.
pnpm
本地安装
🌐 Local installation
需要安装 Node.js。请参阅 pnpm 文档 了解安装说明。
🌐 Requires installing Node.js. See pnpm documentation for installation instructions.
默认情况下,使用 create-expo-app 和 pnpm 创建的项目使用 nodeLinker 并将其值设置为 hoisted 来安装依赖。
🌐 By default, a project created with create-expo-app and pnpm uses nodeLinker with its value set to hoisted to install dependencies.
信息 在 SDK 54 及更高版本中,Expo 支持独立安装,如果你更喜欢使用独立依赖,可以删除
nodeLinker设置。
EAS 安装
🌐 EAS installation
如果项目目录包含 pnpm-lock.yaml,则默认支持。
🌐 Supported by default if the project directory contains pnpm-lock.yaml.
Bun
有关使用 bun 创建新的 Expo 项目、从其他包管理器迁移以及与 EAS 一起使用的详细信息,请参阅 Bun 指南。
🌐 See Bun guide for details on creating a new Expo project with bun, migration from another package manager, and usage with EAS.