---
title: 安装
description: i18n-error-base 的安装方法与运行要求。
---

## 运行要求 [#requirements]

- 可处理 ES 模块的运行环境，例如 Node.js
- 需要 `valibot@^1.0.0` 作为对等依赖

`message` 遵循 Valibot `getGlobalConfig()` 的 `lang`。

## 安装 [#installation]

```package-install
npm i i18n-error-base
```

如果尚未引入 Valibot，请一并添加。

```package-install
npm i valibot
```

:::warning[注意对等依赖]
`valibot` 不会打包。缺少 `valibot@^1.0.0` 时导入将解析失败。
:::

## 导入 [#import]

```ts
import { I18nErrorBase, setErrorMessage } from "i18n-error-base";
import type { ErrorMeta, ErrorOptions, I18nErrorBaseParams, MessageFactory } from "i18n-error-base";
```

## 下一步 [#next-steps]

参见[使用方法](/i18n-error-base/zh/usage)，了解定义与切换基础。
