# Override the default npm registry for bun install

> Change the default npm registry used by `bun install` in `bunfig.toml`, with tokens or credentials from environment variables.

The default registry is `registry.npmjs.org`. Override it globally in `bunfig.toml`.

```toml bunfig.toml icon="settings"
[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 install` automatically loads environment variables from `.env.production.local`, `.env.local`, `.env.production`, and `.env`. When `BUN_ENV` (or, if it is not set, `NODE_ENV`) is `development`, it reads `.env.development.local` and `.env.development` in place of the two production files. It does not read `.env.test`. To load a specific file, pass `--env-file`. To load no file, pass `--no-env-file`. See [Environment variables](https://bun.aphrody.app/docs/runtime/environment-variables).

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

---

See [`bun install`](https://bun.aphrody.app/docs/pm/cli/install).
