Bun

范围和注册表

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

[install]
# set default registry as a string
registry = "https://registry.npmjs.org"
# set a token
registry = { url = "https://registry.npmjs.org", token = "123456" }
# set a username/password
registry = "https://username:[email protected]"

要配置一个特定组织范围内的私有注册表

[install.scopes]
# registry as string
"@myorg1" = "https://username:[email protected]/"

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

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

.npmrc

Bun 目前不读取 .npmrc 文件。对于私有注册表,请将注册表配置迁移到 bunfig.toml,如上所述。