Skip to content

默认注册表是 registry.npmjs.org。这可以在 bunfig.toml 中全局配置。

toml
[install]
# 将默认注册表设置为字符串
registry = "https://registry.npmjs.org"

# 如果需要,设置令牌
registry = { url = "https://registry.npmjs.org", token = "123456" }

# 如果需要,设置用户名/密码
registry = "https://usertitle:password@registry.npmjs.org"

你的 bunfig.toml 可以引用环境变量。Bun 会自动从 .env.local.env.[NODE_ENV].env 加载环境变量。有关更多信息,请参阅 文档 > 环境变量

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

请参阅 文档 > 包管理器 获取 Bun 包管理器的完整文档。

Bun学习网由www.bunjs.com.cn整理维护