> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 添加一个 tarball 依赖

Bun 的包管理器可以安装任何公开可用的 tarball URL 作为你的项目依赖。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun add zod@https://registry.npmjs.org/zod/-/zod-3.21.4.tgz
```

***

运行此命令将会下载、解压并安装该 tarball 到你项目的 `node_modules` 目录。同时，它会将以下内容添加到你的 `package.json` 文件中：

```json package.json icon="file-json" theme={"theme":{"light":"github-light","dark":"dracula"}}
{
  "dependencies": {
    "zod": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz" // [!code ++]
  }
}
```

***

包 `"zod"` 现在可以像平常一样导入使用。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
import { z } from "zod";
```

***

完整的 Bun 包管理器文档请参见 [Docs > Package manager](/pm/cli/install)。
