Bun

指南套件管理員

使用 bun install 為組織範圍設定私人登錄

Bun 不會讀取 .npmrc 檔案;而是透過 bunfig.toml 設定私人登錄。如要為特定 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 套件管理員的完整文件。