Use bun with Pier
Bun’s package manager (bun add, bun install) speaks the standard npm registry protocol and reads .npmrc — identical to npm. The two interesting bits are:
- Abbreviated packument — bun sends
Accept: application/vnd.npm.install-v1+jsonby default. Pier returns a leaner JSON payload (no README, no historical times), making installs noticeably snappier on large packages. - Always sends bearer. Like npm and pnpm, bun sends auth on every request — no
always-auth=trueworkaround needed.
Configure
Section titled “Configure”registry=https://YOUR-PIER-HOST/registry/npm///YOUR-PIER-HOST/registry/npm/:_authToken=pier_npm_…always-auth=truealways-auth=true is harmless for bun. Keep it so the same .npmrc also works for yarn 1 if you ever need it.
Install / add
Section titled “Install / add”bun installbun add left-padbun add @your-org/internal-libbun add -d typescript # devDependencyPublish
Section titled “Publish”bun publishBun supports bun publish from version 1.1+. It uses the same wire format every npm CLI uses (CouchDB-style PUT with _attachments).
Bun doesn’t have its own browser login flow. Use npm login --auth-type=web against Pier — bun reads the same .npmrc:
npm login --auth-type=web --registry=https://YOUR-PIER-HOST/registry/npm/Abbreviated packument savings
Section titled “Abbreviated packument savings”The abbreviated packument strips fields not needed for install resolution:
| Field | Full | Abbreviated |
|---|---|---|
name | ✓ | ✓ |
dist-tags | ✓ | ✓ |
versions[*] | full manifest | only install-time fields |
versions[*].dist.{tarball,integrity} | ✓ | ✓ |
versions[*].readme | ✓ | ✗ |
versions[*].time | ✓ | ✗ |
time (history map) | ✓ | ✗ |
For popular packages (next, react, etc.) the abbreviated form is 5–10× smaller. Pier serves both; the choice is driven by the Accept header.
Versions matrix
Section titled “Versions matrix”| bun version | Status | Notes |
|---|---|---|
| latest (1.x) | ✓ | Tested in pier-tests matrix against current stable |
Pin via packageManager if you want lockstep behavior:
{}Common errors
Section titled “Common errors”error: not found: <pkg>— upstream proxy off + package not privately published. Enable proxy.error: Failed to authenticate— token missing or revoked. Mint a fresh one.error: file not foundon a scoped package — the URL-encoding for@scope/namemight be mangled by an intermediate proxy. Test the raw fetch:curl -H "Authorization: Bearer pier_npm_…" https://pier-host/registry/npm/@scope%2Fname— should return packument JSON.
Related
Section titled “Related”- Setup — base walkthrough.
- CI integration — bun in CI snippets.
- Upstream proxy — when bun installs hit the cache.