Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with workspace dependency resolution when adding new packages #10889

Closed
AlandSleman opened this issue May 7, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@AlandSleman
Copy link

AlandSleman commented May 7, 2024

What version of Bun is running?

1.1.7

What platform is your computer?

Linux 6.8.0-76060800daily20240311-generic x86_64 x86_64

What steps can reproduce the bug?

  1. clone the workspaces example repo https://github.com/AlandSleman/bun-workspace-issue
  2. create a new package
  3. add the new package as a dependency for any other packages and run bun install

What is the expected behavior?

All workspace dependencies, including newly added packages, should be correctly resolved and installed without errors.

What do you see instead?

Instead of the expected smooth dependency resolution and installation, the following issues are observed:

  1. After running bun install An error message indicating that the workspace dependency @oven-sh/c is not found, despite it being correctly defined in the package.json of another package within the workspace.

    error: workspace dependency "@oven-sh/c" not found
    Searched in "./*"
    
  2. After running bun install --verbose a verbose log message suggesting an issue with file operations, specifically mentioning difficulties with moving files from a temporary directory due to restrictions across mount points:

    info: cannot move files from tempdir: RenameAcrossMountPoints, using fallback
    

These issues suggest problems with Bun's handling of local workspace dependencies and potentially its file system operations in certain environments, leading to unsuccessful installations and unresolved dependencies.

Additional information

A repository demonstrating the issue: https://github.com/AlandSleman/bun-workspace-issue

  • This issue persists even after deleting lock files and trying to reinstall dependencies. I have encountered this problem multiple times while working with Bun workspaces, indicating a recurring issue under certain conditions.
  • Sometimes, deleting lock files and reinstalling dependencies has resolved the issue, but it does not consistently fix the problem.
@AlandSleman AlandSleman added the bug Something isn't working label May 7, 2024
@AlandSleman AlandSleman changed the title Error with workspace dependency resolution in when adding new packages Error with workspace dependency resolution when adding new packages May 7, 2024
@AlandSleman
Copy link
Author

After diving deeper, I think the issue is with the * wildcard, after explicitly specifying the workspaces/packages in the package.json.

So instead of using:

  "workspaces": [
    "packages/*",
    "apps/*"
  ],

You could specify:

  "workspaces": [
    "apps/backend",
    "packages/backend-api"
  ],

After explicitly defining packages and installing the packages, the * wildcard does work correctly for including all packages and apps.
I'm keeping this issue open because there could be an underlying issue with the * wildcard when configuring packages/workspaces, I also think it involves caching. Please correct me if I'm wrong.

@dylan-conway
Copy link
Collaborator

Fixed in #11177 and available in canary (bun upgrade --canary to update). Please reopen this issue if you continue to have problems with workspaces, or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants