aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/install/custom-registry.md
blob: 12bb3b77f83b94c465f7e844cbc6552f2b93abdc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
name: Override the default npm registry for bun install
---

The default registry is `registry.npmjs.org`. This can be globally configured in `bunfig.toml`.

```toml#bunfig.toml
[install]
# set default registry as a string
registry = "https://registry.npmjs.org"

# if needed, set a token
registry = { url = "https://registry.npmjs.org", token = "123456" }

# if needed, set a username/password
registry = "https://username:password@registry.npmjs.org"
```

---

Your `bunfig.toml` can reference environment variables. Bun automatically loads environment variables from `.env.local`, `.env.[NODE_ENV]`, and `.env`. See [Docs > Environment variables](/docs/runtime/env) for more information.

```toml#bunfig.toml
[install]
registry = { url = "https://registry.npmjs.org", token = "$npm_token" }
```

---

See [Docs > Package manager](/docs/cli/install) for complete documentation of Bun's package manager.