> ## Documentation Index
> Fetch the complete documentation index at: https://bun.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://bun.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://bun.manicule.dev/api/mcp.
> Every agent surface: https://bun.manicule.dev/.well-known/llms-manifest.json

# Add a peer dependency (/guides/install/add-peer)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 184 · updated: 2026-08-02 -->
Related: [Add a dependency](/guides/install/add.md), [Add a development dependency](/guides/install/add-dev.md), [Add an optional dependency](/guides/install/add-optional.md), [Add a Git dependency](/guides/install/add-git.md), [Add a tarball dependency](/guides/install/add-tarball.md), [Install a package under a different name](/guides/install/npm-alias.md)

To add an npm package as a peer dependency, use the `--peer` flag.

```sh icon="terminal" title="terminal" terminal
bun add @types/bun --peer
```

***

This adds the package to `peerDependencies` in `package.json`.

```json icon="file-json" title="package.json"
{
  "peerDependencies": {
    "@types/bun": "^1.3.3" // [!code ++]
  }
}
```

***

`bun install` installs peer dependencies by default, unless they are marked optional in `peerDependenciesMeta`.

```json icon="file-json" title="package.json"
{
  "peerDependencies": {
    "@types/bun": "^1.3.3"
  },
  "peerDependenciesMeta": {
    "@types/bun": { // [!code ++]
      "optional": true // [!code ++]
    } // [!code ++]
  }
}
```

***

See [`bun install`](/pm/cli/install).
