Skip to main content

升级到 Strapi 5:简介和常见问题

¥Upgrading to Strapi 5: Introduction and FAQ

Strapi 的最新主要版本是 Strapi 5。Strapi v4 仍受支持,直到 2026 年 3 月。

¥The latest major version of Strapi is Strapi 5. Strapi v4 is still supported until March 2026.

每当你准备好升级到 Strapi 5 时,当前页面都会为你提供帮助。它列出了从 Strapi 4 升级到 Strapi 5 的所有可用资源,并回答你可能遇到的一般问题。

¥Whenever you feel ready to upgrade to Strapi 5, the present page will help you. It lists all available resources for upgrading from Strapi 4 to Strapi 5 and answers general questions you might have.

可用资源

¥Available resources

以下所有可用资源将帮助你将应用和插件升级到 Strapi 5,从最常见到最具体的用例:

¥All of the following available resources will help you upgrade your application and plugins to Strapi 5, from the most common to the most specific use cases:

常见问题

¥Frequently asked questions

以下问题及其答案应可帮助你涵盖最常见的用例:

¥The following questions and their answers should help you cover the most common use cases:

How can I handle the upgrade and the installation of the latest dependencies?
How can I handle the breaking changes in the code and adapt my code to Strapi 5?

Strapi 提供了 升级工具 来简化该过程。升级工具是一个命令行工具,带有一些命令,用于处理依赖的升级和 codemods 的执行。

¥Strapi provides an upgrade tool to ease the process. The upgrade tool is a command line tool with some commands that handle the upgrade of the dependencies and the execution of codemods .

按照 分步指南 了解如何在升级到 Strapi 5 的背景下使用此工具。

¥Follow the step-by-step guide to learn how to use this tool in the context of upgrading to Strapi 5.

Strapi 5 文档还提供了 完整的重大更改数据库专用资源 来涵盖特定用例。

¥Strapi 5 docs also provide a complete breaking changes database and dedicated resources to cover specific use cases.

How can I handle the data migration, ensuring that in Strapi 5 the application will still be working?

Strapi 5 integrates a series of data migration scripts that are run once the application starts for the first time in Strapi 5.

However, please always backup your database (found at .tmp/data.db by default if using a SQL database) before performing any upgrade, as instructed in the step-by-step guide.

As a Strapi Cloud customer, how can I handle the entire upgrade and deployment of my Strapi 5 application?
❗️ 警告:暂时不要将 Strapi 5 项目推送到 Strapi Cloud

Strapi Cloud 仍在 Strapi v4 上运行。以下过程作为 Strapi 5 作为稳定版本发布时将发生的情况的指示提供。不要尝试将你的 Strapi 5 beta 或候选版本 (RC) 项目推送到 Strapi Cloud。

¥Strapi Cloud is still running on Strapi v4. The following process is provided as an indication of what will happen when Strapi 5 is released as a stable version. Do not try to push your Strapi 5 beta or Release Candidate (RC) project to Strapi Cloud yet.

  1. 创建备份 并按照 分步指南 在本地更新你的代码。

    ¥Create a backup and update your code locally, following the step-by-step guide.

  2. Cloud CLI 运行 yarn deploynpm run deploy 命令。

    ¥Run the yarn deploy or npm run deploy commands from the Cloud CLI.

Strapi Cloud 将在 Strapi 5 中部署更新的代码,并自动运行数据迁移脚本。

¥Strapi Cloud will deploy the updated code in Strapi 5 and will automatically run the data migration script.