rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

To add an npm package as a dependency, use bun add.

terminal

bun add zod

This will add the package to dependencies in package.json. By default, the ^ range specifier will be used, to indicate that any future minor or patch versions are acceptable.

package.json

{
  "dependencies": {
    "zod": "^3.0.0"
  }
}

To “pin” to an exact version of the package, use --exact. This will add the package to dependencies without the ^, pinning your project to the exact version you installed.

terminal

bun add zod --exact

To specify an exact version or a tag:

terminal

bun add zod@3.0.0
bun add zod@next

See Docs > Package manager for complete documentation of Bun’s package manager.

Was this page helpful?

Suggest editsRaise issue

[

Read environment variables

Previous

](../../runtime/read-env/index.md)[

Add a development dependency

Next

](../add-dev/index.md)