# 安装

URL: https://caijiao.org/zod/installation
Source: docs/zod/installation.md
Description: 学习如何在你的项目中安装和配置 Zod，包括环境要求和安装步骤

## 必要条件

- TypeScript 4.5+!
- 你必须在你的`tsconfig.json`中启用`strict`模式。这是所有 TypeScript 项目的最佳实践。

```ts
// tsconfig.json
{
  // ...
  "compilerOptions": {
    // ...
    "strict": true
  }
}
```

## 从 npm 安装

```bash
npm install zod          # npm
yarn add zod            # yarn
pnpm add zod           # pnpm
bun add zod            # bun
deno add npm:zod       # deno
```

## 使用 CDN

```html
<script src="https://unpkg.com/zod"></script>
```

## 在 Deno 中使用

```ts
import { z } from "https://deno.land/x/zod/mod.ts";
```
