This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
设置你的工具
在本章中,安装一个 AI 编码代理、Node.js 和 Expo Go,并教授你的代理关于 Expo 的知识。
在本章中,你将从零开始安装所需的一切。这是最长的一章。一旦你的工具安装好了,乐趣就开始了,其余的教程会进展得很快。
🌐 In this chapter, you'll install everything you need, starting from zero. This is the longest chapter. Once your tools are set up, the fun starts and the rest of the tutorial moves quickly.
4 要求
4 要求
1.
2.
一部 Android 或 iOS 手机,连接到与你的电脑相同的 Wi-Fi 网络。
3.
一个人工智能编程代理和你选择的服务账户。
4.
1
打开终端
🌐 Open a terminal
终端是你与 AI 代理交流的应用。
🌐 The terminal is the app where you'll talk to your AI agent.
- 在 macOS 上,打开内置的 终端 应用。你可以通过打开聚焦搜索(Cmd ⌘ + 空格)并输入“终端”来找到它。
- 在 Windows 上,从开始菜单打开 PowerShell。在本章中,你将输入一些命令。每个命令都已为你提供,可以复制粘贴。
如果你打算使用 Cursor,在本教程的大部分时间里你将会在其可视化编辑器中工作,而不是在终端中,但请保持终端可用,因为你仍然需要用它来运行你的应用。
2
安装一个人工智能代理
🌐 Install an AI agent
如果你已经使用 AI 编程助手,请跳到下一步。否则,请从下面选择一个。本教程在使用任何一个时都适用。
🌐 If you already use an AI coding agent, skip to the next step. Otherwise, pick one below. This tutorial works the same with any of them.
在你的终端窗口中运行以下命令以安装 Claude Code:
🌐 Run the following command in your terminal window to install Claude Code:
在 Windows 上: 如果你使用 PowerShell 安装 Claude Code,请运行
irm https://claude.ai/install.ps1 | iex。
然后在终端中运行 claude 并按照说明登录。如果遇到问题,请参阅 Claude Code 安装指南。
🌐 Then run claude in your terminal and follow the instructions to sign in. See the Claude Code setup guide if you run into trouble.
在你的终端窗口中运行以下命令以安装 Codex:
🌐 Run the following command in your terminal window to install Codex:
然后在你的终端中运行 codex,并按照说明使用你的 ChatGPT 账户登录。如果遇到问题,请参阅 Codex CLI 文档。
🌐 Then run codex in your terminal and follow the instructions to sign in with your ChatGPT account. See the Codex CLI documentation if you run into trouble.
其他代理也可以。只要你的代理能够编辑文件并在你的电脑上运行命令,你就可以跟着操作。
🌐 Other agents work too. As long as your agent can edit files and run commands on your computer, you can follow along.
3
安装 Node.js
🌐 Install Node.js
让我们运行你的第一个提示并安装 Node.js。
🌐 Let's run your first prompt and install Node.js.
Node.js 是支撑 Expo 开发者工具的运行时。运行以下提示,它将指示你的代理从 nodejs.org 下载 长期支持 (LTS) 版本。
🌐 Node.js is the runtime that powers Expo's developer tools. Run the following prompt that will instruct your agent to download the Long-Term Support (LTS) version from nodejs.org.
要确认它是否有效,请通过打开一个新的终端窗口运行以下命令。它应显示当前安装的 Node.js 版本号:
🌐 To confirm it worked, run the following command by opening a new terminal window. It should print Node.js version number currently installed:
4
安装 Expo Go 并创建一个 Expo 账户
🌐 Install Expo Go and create an Expo account
Expo Go 是一款免费的应用,让你在构建项目的同时在手机上进行测试,无需发布到应用商店。每当你的代理更改代码时,你手机上的应用会在几秒钟内更新。
🌐 Expo Go is a free app that lets you test your project on your phone while you build it, with no app store publishing required. Every time your agent changes the code, the app on your phone updates within seconds.
- 在你的手机上从 Google Play 商店或 Apple App Store 安装 Expo Go。
- 在你的电脑上访问 expo.dev/signup 创建一个免费账户。
- 在手机上打开 Expo Go,并使用相同的账户登录。
在真实的 iOS 设备上,Expo Go 只有在 Expo CLI 登录了同一个账号时才会打开你的项目。现在登录 Expo CLI 吧:
🌐 On a physical iOS device, Expo Go opens your project only when Expo CLI is signed in to the same account. Sign in to Expo CLI now:
5
教你的代理有关 Expo 的知识
🌐 Teach your agent about Expo
Expo Skills 是教学文件,用于教 AI 代理如何有效构建 Expo 应用:使用哪些库、如何构建屏幕结构以及如何避免常见错误。安装它们是让你的代理取得好效果的最重要的一步。
🌐 Expo Skills are instruction files that teach AI agents how to build Expo apps well: which libraries to use, how to structure screens, and how to avoid common mistakes. Installing them is the single biggest thing you can do to get good results from your agent.
启动 claude,然后在其中运行以下命令:
🌐 Start claude, then run the following command inside it:
在你的终端中运行以下命令:
🌐 Run the following command in your terminal:
在你的终端中运行以下命令:
🌐 Run the following command in your terminal:
然后重新打开 Cursor 并确认技能是否出现在 设置 > 规则、技能、子代理 > 技能 下。
🌐 Then reopen Cursor and verify the skills appear under Settings > Rules, Skills, Subagents > Skills.
每个代理的完整安装说明,以及所有可用技能的列表。
6
连接 Expo MCP 服务器
🌐 Connect the Expo MCP server
Expo MCP 服务器为你的代理提供直接访问 Expo 工具的权限:它可以阅读最新的 Expo 文档、安装正确的包,并检查你的项目。
🌐 The Expo MCP server gives your agent direct access to Expo's tools: it can read the latest Expo documentation, install the right packages, and inspect your project.
在你的终端中运行以下命令:
🌐 Run the following command in your terminal:
然后启动 claude 并在其中运行 /mcp,以使用你在上一步创建的 Expo 账户登录。
🌐 Then start claude and run /mcp inside it to sign in with the Expo account you created in the previous step.
在终端中运行以下命令,并在提示时使用你在上一步创建的 Expo 账户登录:
🌐 Run the following command in your terminal, and sign in with the Expo account you created in the previous step when prompted:
可选:让你的代理查看并点击你的应用
MCP 服务器也提供本地功能:通过额外设置,多模态代理可以截取你在模拟器中运行的应用截图、点击按钮,并验证自己的操作。这需要你电脑上有模拟器(iOS 仅限 macOS),所以超出了本教程范围。在接下来的章节中,你将自己在手机上验证应用。如果你以后想尝试,可以参考 设置本地功能。
🌐 The MCP server also offers local capabilities: with extra setup, a multimodal agent can take screenshots of your app running in a simulator, tap buttons, and verify its own work. This requires a simulator on your computer (macOS only for iOS), so it's beyond this tutorial. In the chapters ahead, you are the one verifying the app on your phone. If you want to explore it later, see Set up local capabilities.
完整的安装说明、可用工具和数据隐私详情。
7
概括
🌐 Summary
Chapter 1: Set up your tools
Your toolkit is complete: an AI agent that knows how to build Expo apps, Node.js to power the tooling, and Expo Go on your phone to see the results.
In the next chapter, your agent creates a new app and you see it running on your phone.