This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

“项目与这个版本的 Expo Go 不兼容” 错误

了解为什么一个 Expo 项目与已安装的 Expo Go 版本不兼容,以及如何安装兼容的版本。


当项目中的 Expo SDK 版本与已安装的 Expo Go 应用中的 SDK 版本不匹配时,Expo Go 会显示此错误:

🌐 Expo Go displays this error when the Expo SDK version in a project does not match the SDK version included in the installed Expo Go app:

Project is incompatible with this version of Expo Go

你可能还会看到以下其中一条消息:

🌐 You may also see one of these messages:

The project you requested requires a newer version of Expo Go. This project requires a newer version of Expo Go.

为什么会这样

🌐 Why this happens

每个 Expo Go 版本都包含一个 Expo SDK 版本。package.json 中的 expo 包版本决定了项目的 SDK 版本。项目的 SDK 版本和 Expo Go 的 SDK 版本必须一致。

🌐 Each build of Expo Go includes one Expo SDK version. The expo package version in package.json sets the project's SDK version. The project and Expo Go SDK versions must match.

Apple App Store 上的 Expo Go 停留在 SDK 54,SDK 55 及更高版本在那儿不可用。Google Play 版本也可能会落后于新的 SDK 发布。如果你的项目使用的 SDK 比商店版本更新,请使用下面的选项,而不是等商店更新。

🌐 Expo Go on the Apple App Store stops at SDK 54, and SDK 55 and later are not available there. The Google Play version can also lag behind a new SDK release. If your project uses a newer SDK than the store build, use one of the options below instead of waiting for a store update.

安装一个兼容版本的 Expo Go

🌐 Install a compatible version of Expo Go

使用你测试项目的设备说明书。

🌐 Use the instructions for the device where you are testing your project.

实物 iPhone 或 iPad

🌐 Physical iPhone or iPad

对于使用 SDK 54 或更高版本的项目,使用 eas go 来构建 Expo Go,并通过你的 TestFlight 内部团队分发,这需要 Apple 开发者计划的会员资格。对于使用 SDK 54 的项目,你也可以从苹果 App Store 安装 Expo Go。

🌐 For projects using SDK 54 or later, use eas go to build Expo Go and distribute it through your TestFlight internal team, which needs an Apple Developer Program membership. For projects using SDK 54, you can also install Expo Go from the Apple App Store.

对于使用 SDK 53 或更早版本的项目,你无法在真实的 iOS 设备上安装旧版本的 Expo Go。你可以升级项目、使用安卓设备或 iOS 模拟器,或者创建一个开发版。

🌐 For projects using SDK 53 or earlier, you cannot install an older version of Expo Go on a physical iOS device. Upgrade the project, use an Android device or iOS Simulator, or create a development build.

安卓设备、安卓模拟器或 iOS 模拟器

🌐 Android device, Android Emulator, or iOS Simulator

访问 expo.dev/go,选择你的项目使用的 SDK 版本和目标平台,然后安装兼容的 Expo Go 版本。

🌐 Visit expo.dev/go, select the SDK version used by your project and your target platform, then install the compatible Expo Go build.

你也可以使用expo-go CLI来下载特定版本。

🌐 You can also use the expo-go CLI to download a specific version.

安装兼容版本后,使用 npx expo start 重启开发服务器,然后重新打开项目。

🌐 After installing the compatible build, restart the development server with npx expo start and open the project again.

检查一下项目的 SDK 版本

🌐 Check the project's SDK version

如果在安装了正确的 Expo Go 版本后错误仍然存在:

🌐 If the error remains after installing the correct Expo Go build:

  1. 查看 package.json 中的 expo 依赖,以确认项目的 SDK 版本。
  2. 如果你的应用配置包含一个sdkVersion字段,要么把它移除,要么确保它与你的expo依赖匹配。
  3. 运行 npx expo-doctor@latest 来检查依赖版本问题。
  4. 运行 npx expo install --fix 来使软件包版本与已安装的 Expo SDK 对齐。

升级项目或使用开发版本

🌐 Upgrade the project or use a development build

你可以将项目升级到更新的 Expo SDK,而不是安装另一个版本的 Expo Go。

🌐 You can upgrade the project to a newer Expo SDK instead of installing another version of Expo Go.

Expo Go 是一个学习环境和沙箱。对于生产项目,创建一个开发构建,这样本地应用及其依赖就由你的项目控制。

🌐 Expo Go is a learning environment and sandbox. For a production project, create a development build so the native app and its dependencies are controlled by your project.