bun
bun copied to clipboard
workspace packages list gets stale if new workspace packages are depended on
What version of Bun is running?
v0.6.15 (17903570)
What platform is your computer?
Darwin 21.6.0 arm64 arm
What steps can reproduce the bug?
Create a file package.json with:
{
"name": "bun-workspaces",
"module": "index.ts",
"type": "module",
"workspaces": [
"packages/a"
],
"dependencies": {
"a": "workspace:^"
}
}
Create a second file packages/a/package.json with:
{
"name": "a",
"version": "1.0.0"
}
Then run bun install in the root.
What is the expected behavior?
It creates a node_moudules with a symlinked to packages/a.
What do you see instead?
Error
error: Workspace name "a" already exists
{
^
Additional information
As a workaround, replacing workspace:^ with workspace:* works.
For reference, these are the semantics of the workspace: protocol in yarn and pnpm.
I have a different issue around workspaces, I get
error: workspace dependency "@techstack/tcm-cli" not found
Searched in "./*"
This happens on bun install
I have a different issue around workspaces, I get
error: workspace dependency "@techstack/tcm-cli" not found Searched in "./*"This happens on bun install
This was working fine for me until I ran bun clean. Then I started getting the same error as above when running bun install.
I have
"workspaces": [
"apps/*",
"packages/*"
]
in my package.json.
@potrepka I'm glad it's not just me who's getting this
I have a different issue around workspaces, I get
error: workspace dependency "@techstack/tcm-cli" not found Searched in "./*"This happens on bun install
Getting this issue as well, not sure what's going on. Following everything in the docs, trying to port over from pnpm to bun as a package manager but this is kind of a roadblock atm.
Same issue. To reproduce:
git clone https://github.com/gitcoinco/grants-stack- add a
workspaces: ["packages/*"]to the root package.json - bun install in root
- observe the error
error: workspace dependency "common" not found
Searched in "./*"
The same issue for me :(
P.S. Just tried it with pnpm and pnpm-workspace.yaml and everything works fine
I'm also getting this error `error: workspace dependency "some_package" not found
Searched in "./*"`
package.json is correctly configured with "packages/*", also tried specifying the packages individually, didn't work.
Coming from pnpm workspaces, I had no such issue there.
I got it to work by deleting the bun.lockb file and running bun install again.
It appears to happen sporadically. I'm not sure what's going wrong under the hood. Also had no such issue with pnpm.
getting the same issue, any updates?
I think all errors error: workspace dependency not found are a different error than the original one. This issue is specifically about using the qualifier ^ for the workspace: protocol.
If you are getting error: workspace dependency not found chances are you are hitting a different error. I'll be happy to help diagnose it, but you need to include your package.json for both the consumer and the missing workspace dependency.
I got it to work by deleting the
bun.lockbfile and runningbun installagain.It appears to happen sporadically. I'm not sure what's going wrong under the hood. Also had no such issue with pnpm.
this really helped! thanks
also, my 2 cents here, I noticed that every time I create a new package inside the workspace packages/* and try to install this as a dependency of any other module, it keeps throwing the error, I'm thinking that it has something to do with bun binary that is not being able to "update" or something like that, like it's trying to resolve dependencies as the older state that didn't had information about the latest package module. After deleting bun.lockb file and trying to install it works perfectly.
This looks like it only is a problem for the first module that tries to install the new package, something like:
- Create a new module inside
packages/* - Try to install as a dependency from another module, it breaks
- Remove
bun.lockb - Try to install again and it should work
- Try to add the same package as dependency to another module
bun installworks without having to deletebun.lockbagain
if i try to remove a package from dependencies and then bun install, it works as expected, so it seems that it's only for newly created packages added as dependency for the first time
Confirming this is not fixed as of Bun v1.0.11
The bug is not specifically related to the workspace version specifier. It is due to not updating the list of workspace_versions and workspace package names on each run, which causes the list to get stale
Do we know when this will be fixed?
On Wed, 15 Nov 2023, 07:48 Jarred Sumner, @.***> wrote:
Confirming this is not fixed as of Bun v1.0.11
The bug is not specifically related to the workspace version specifier. It is due to not updating the list of workspace_versions and workspace package names on each run, which causes the list to get stale
reproduction.zip https://github.com/oven-sh/bun/files/13361754/worky1.zip
— Reply to this email directly, view it on GitHub https://github.com/oven-sh/bun/issues/3686#issuecomment-1811958849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOFWX4CZZCP5H2QPWHC5K3YERXWLAVCNFSM6AAAAAA2QQPGHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRHE2TQOBUHE . You are receiving this because you commented.Message ID: @.***>
Getting same error on 1.0.22, if I delete bun.lockb then bun install works again but I have to remove after I install a new package or if a added a new folder under the directories listed on workspaces: [] package.json array.
This issue was fixed around ~1.0.10 and this comment was likely fixed in #11177 . Going to close this as fixed, please reopen or open a new issue if you continue to have issues with installing workspace packages.