Skip to content

Bun 支持直接添加 GitHub 倉庫作為項目的依賴。

sh
bun add github:lodash/lodash

這會在你的 package.json 中添加以下行:

json
{
  "dependencies": {
    "lodash": "github:lodash/lodash"
  }
}

Bun 支持多種指定 Git 依賴的協議。

sh
bun add git+https://github.com/lodash/lodash.git
bun add git+ssh://github.com/lodash/lodash.git#4.17.21
bun add git@github.com:lodash/lodash.git
bun add github:colinhacks/zod

注意: GitHub 依賴在可能時通過 HTTP tarball 下載以實現更快的安裝。


請參閱 文檔 > 包管理器 獲取 Bun 包管理器的完整文檔。

Bun學習網由www.bunjs.com.cn整理維護