bun icon indicating copy to clipboard operation
bun copied to clipboard

Failing when adding new "workspace:*" dependencies

Open robertherber opened this issue 2 years ago • 4 comments

What version of Bun is running?

1.0.20+09d51486e

What platform is your computer?

Darwin 23.2.0 arm64 arm

What steps can reproduce the bug?

Previously I've been able to add workspace dependencies like this:

"@scope/my-workspace-dependency": "workspace:*"

This also looks valid according to the documentation.

After adding a completely new workspace dependency like this I now suddenly get this when running bun install:

error: workspace dependency "@scope/my-workspace-dependency" not found

Searched in "./*"

The search path seems off, it should look in packages/* and apps/*. If I run bun install in the directory where the package with the added dependency installed I instead get:

error: workspace dependency "@scope/my-workspace-dependency" not found

Searched in "./@scope/my-workspace-dependency"

A workaround I've found is to specify the workspace dependency with relative path, but it is not as clean as workspace:*:

"@scope/my-workspace-dependency": "workspace:../../packages/my-workspace-dependency"

What is the expected behavior?

I would expect the install to succeed, as it did in previous versions.

What do you see instead?

error: workspace dependency "@scope/my-workspace-dependency" not found

Searched in "./*"

Additional information

No response

robertherber avatar Dec 29 '23 12:12 robertherber

I'm using workspace dependencies with Bun and it works just fine with workspace:*. Are you sure that a) the correct name is present in the package.json for my-workspace-dependency, and b) that you're using the latest version of Bun (v1.0.20)?

ghost avatar Dec 29 '23 21:12 ghost

@aarvinr It seems to only happen for completely new workspace packages, once I've managed to run bun install once it works to reference by "workspace:*" again

robertherber avatar Dec 30 '23 14:12 robertherber

@aarvinr It seems to only happen for completely new workspace packages, once I've managed to run bun install once it works to reference by "workspace:*" again

Can confirm this behavior... Super annoying having to spend a bunch of time getting bun to first recognize a package

juliusmarminge avatar Apr 10 '24 22:04 juliusmarminge

I was on 1.0.2, and I just upgraded to the latest version and it seems to be fixed.

donnes avatar May 06 '24 04:05 donnes

Thanks @donnes. Running bun upgrade fixed it for me as well. I believe it was solved on v1.1.9

carlos-garciamoran avatar Jun 04 '24 20:06 carlos-garciamoran