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整理维护