Bun 不读取 .npmrc
文件;相反,私有注册表通过 bunfig.toml
进行配置。要为特定 npm 范围配置注册表
[install.scopes]
# as a string
"@myorg1" = "https://username:[email protected]/"
# 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
加载环境变量。有关更多信息,请参阅 文档 > 环境变量。
[install.scopes]
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }
有关 Bun 包管理器的完整文档,请参阅 文档 > 包管理器。