# CLI 的默认包管理器不再是 yarn

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/yarn-not-default

🌐 The CLI default package manager is not yarn anymore

在 Strapi 5 中，CLI 会检测你的包管理器并使用它来安装依赖，而不是默认使用 `yarn`。如果你需要特别强制使用 yarn，请使用 `--use-yarn` 标志。

🌐 In Strapi 5, the CLI detects your package manager and uses it to install dependencies instead of defaulting to `yarn`. Use the `--use-yarn` flag if you need to enforce yarn specifically.

在 Strapi v5 中，用于运行依赖安装的命令是实际安装它们的命令。

🌐 In Strapi v5, the command used to run dependencies installation is the one used to actually install them.

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? No
- Is this breaking change automatically handled by a codemod? No

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

以下所有命令都尝试使用 `yarn` 来安装应用依赖：

🌐 All the following commands try to use `yarn` to install the application dependencies:

- `npx create-strapi-app`
- `npm create strapi-app`
- `yarn create strapi-app`
- `yarn dlx …`

**在 Strapi 5 中**

Strapi 会检测你用于运行 CLI 的包管理器，并使用此包管理器安装依赖。

🌐 Strapi detects what package manager you are using to run the CLI, and uses this package manager to install dependencies.

## 迁移 {#migration}

🌐 Migration

<br/>

### 注意 {#notes}

🌐 Notes

* 由于 Strapi 检测用于运行命令的包管理器并使用它来安装依赖，这意味着将发生以下示例用例：
  - `npx create-strapi-app` 使用 `npm` 安装依赖
  - `npm create …` 使用 `npm` 安装依赖
  - `yarn create …` 使用 `yarn` 安装依赖
  - `yarn dlx …` 使用 `yarn` 安装依赖
  - `pnpm create …` 使用 `pnpm` 安装依赖
  - `pnpm dlx …` 使用 `pnpm` 安装依赖

### 手动操作 {#manual-procedure}

🌐 Manual procedure

已有项目的用户不会受到影响。只有进行特定自动化和脚本操作的用户或习惯于运行 `create-strapi-app` 命令并期望默认使用 yarn 的插件开发者会受到影响。

🌐 Users with existing projects are not impacted. Only users doing specific automation and scripts or plugin developers that are used to running a `create-strapi-app` command and expect yarn to be used by default will be impacted.

例如，如果你想使用 npx，但仍然强制使用 yarn 来安装依赖，请添加一个 `--use-yarn` 标志。有关可能标志的其他信息，请参阅 [CLI 安装参考](/cms/installation/cli#cli-installation-options)。

🌐 If, for instance, you want to use npx but still enforce using yarn to install dependencies, add a `--use-yarn` flag. Additional information about the possible flags is available in the [CLI installation reference](/cms/installation/cli#cli-installation-options).
