Bun

指南包管理器

为具有 bun install 的组织范围配置私有注册表

可以通过 .npmrcbunfig.toml 配置注册表。虽然两者都受支持,但我们建议使用 bunfig.toml 以获得更强的灵活性和 Bun 特定的选项。

为特定 npm 范围配置注册表

bunfig.toml
[install.scopes]
# as a string
"@myorg1" = "https://username:password@registry.myorg.com/"

# as an object with username/password
# you can reference environment variables
"@myorg2" = {
  username = "myusername",
  password = "$npm_pass",
  url = "https://registry.myorg.com/"
}

# as an object with token
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }

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

bunfig.toml
[install.scopes]
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }

有关 Bun 包管理器的完整文档,请参阅 文档 > 包管理器