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 要求

1.

一台电脑
一台运行 macOS、Windows 或 Linux 的电脑。

2.

一部电话

一部 Android 或 iOS 手机,连接到与你的电脑相同的 Wi-Fi 网络。

3.

一个 AI 代理及其账户

一个人工智能编程代理和你选择的服务账户。

4.

大约20分钟
这就是整个设置所需的一切。

1

打开终端

🌐 Open a terminal

终端是你与 AI 代理交流的应用。

🌐 The terminal is the app where you'll talk to your AI agent.

  • 在 macOS 上,打开内置的 终端 应用。你可以通过打开聚焦搜索(Cmd ⌘ + 空格)并输入“终端”来找到它。
  • 在 Windows 上,从开始菜单打开 PowerShell。在本章中,你将输入一些命令。每个命令都已为你提供,可以复制粘贴。
Your terminal may look different depending on your operating system and settings, but it will work the same.

如果你打算使用 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:

Terminal
curl -fsSL https://claude.ai/install.sh | bash

在 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.

其他代理也可以。只要你的代理能够编辑文件并在你的电脑上运行命令,你就可以跟着操作。

🌐 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.

Prompt
I'm following the Expo "Build with AI" tutorial on a brand-new setup and I have no programming experience. Please install the latest LTS version of Node.js on my computer. - First, tell me in one or two plain sentences what you're about to do. - Detect my operating system and use the most reliable method for it. - When you're done, verify it worked by showing me the output of `node --version` and `npm --version`, and tell me if I need to reopen anything for it to take effect.

要确认它是否有效,请通过打开一个新的终端窗口运行以下命令。它应显示当前安装的 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:

Terminal
node --version

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.

  1. 在你的手机上从 Google Play 商店或 Apple App Store 安装 Expo Go
  2. 在你的电脑上访问 expo.dev/signup 创建一个免费账户。
  3. 在手机上打开 Expo Go,并使用相同的账户登录。

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:

Terminal
/plugin install expo@claude-plugins-official
Expo 技能

每个代理的完整安装说明,以及所有可用技能的列表。

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:

Terminal
claude mcp add --transport http expo https://mcp.expo.dev/mcp

然后启动 claude 并在其中运行 /mcp,以使用你在上一步创建的 Expo 账户登录。

🌐 Then start claude and run /mcp inside it to sign in with the Expo account you created in the previous step.

可选:让你的代理查看并点击你的应用

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.

Expo MCP 服务器

完整的安装说明、可用工具和数据隐私详情。

7

测试你的设置

🌐 Test your setup

让我们确认一切都已接好。将以下提示粘贴到你的代理中:

🌐 Let's confirm everything is wired up. Paste the following prompt into your agent:

Prompt
Use the Expo MCP server to search the Expo documentation for "expo-image-picker" and tell me in one sentence what it does.

你应该看到的内容:代理调用 Expo 文档工具,并回复一句关于从设备的照片库中选择图片的句子。如果它报告连接或身份验证错误,请重复上一步的登录部分。

概括

🌐 Summary

Chapter 1: Set up your tools

你的工具包已完整:一个懂得如何构建 Expo 应用的 AI 代理,支持工具的 Node.js,以及用来在手机上查看结果的 Expo Go。

在下一章中,你的代理创建了一个新应用,你会看到它在你的手机上运行。

下一个:创建你的第一个应用