bun icon indicating copy to clipboard operation
bun copied to clipboard

bun link does not work with catalog

Open shyim opened this issue 5 months ago • 3 comments
trafficstars

What version of Bun is running?

1.2.16-canary.22+022a567af

What platform is your computer?

Darwin 24.5.0 arm64 unknown

What steps can reproduce the bug?

root package.json

{
        "workspaces": {
                "packages": ["api"],
                "catalog": {
                        "typescript": "5.8.3"
                }
        }
}

root api/package.json

{
"devDependencies": {
                "typescript": "catalog:"
        }
}

Run bun install in root works as expected. Try to run bun link <some-page>, it fails with

error: typescript@catalog: failed to resolve

What is the expected behavior?

bun link works together with catalog

What do you see instead?

error: typescript@catalog: failed to resolve

Additional information

No response

shyim avatar May 29 '25 09:05 shyim

I think this is caused by bun link/unlink not recognizing workspaces correctly. The command does not see the root package.json so it doesn't read the catalog map and fails to resolve any catalogs in the current project.

dylan-conway avatar May 30 '25 21:05 dylan-conway

bun version: 1.2.9 platform: Darwin 24.4.0 arm64

I am also facing the same issue: I have added express in catalogs at the root package.json.

{
  "name": "hunch-engine",
  "private": true,
  "workspaces":{ 
    "packages":["apps/*", "packages/*"]
  },
  "catalogs": {
    "backend": {
      "express": "^5.1.0"
    }
  }
}

and then referenced express in one of my apps like this:

{
  "name": "@hunch-app/task-queue",
  "module": "index.ts",
  "type": "module",
  "private": true,
  "devDependencies": {
    "@types/bun": "latest"
  },
  "peerDependencies": {
    "typescript": "^5"
  },
  "dependencies": {
    "express": "catalog:backend"
  }
}

Now, when I try to bun install at the app or at root it throws error:

✗ bun install
bun install v1.2.9 (9a329c04)
error: "git clone" for "express" failed

error: InstallFailed cloning repository for express
error: express@catalog:backend failed to resolve

AayushOjha avatar Jun 10 '25 02:06 AayushOjha

@AayushOjha

  1. catalogs should be inside workspaces. See: https://bun.sh/docs/install/catalogs#1-define-catalogs-in-root-package-json
  2. Use Bun v1.2.14

abhijit-hota avatar Jun 12 '25 01:06 abhijit-hota

Still seeing this issue on Bun v1.2.17

ThallesP avatar Jun 25 '25 21:06 ThallesP

bun v1.2.18 works for me

xyzwps avatar Jul 04 '25 16:07 xyzwps