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

Workspace-References are not used in bun install #4366

Closed
Suven opened this issue Aug 27, 2023 · 3 comments
Closed

Workspace-References are not used in bun install #4366

Suven opened this issue Aug 27, 2023 · 3 comments
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@Suven
Copy link

Suven commented Aug 27, 2023

What version of Bun is running?

0.8.1+16b4bf341acc0f4804f0b6bdf5298c180cd00366

What platform is your computer?

Darwin 23.0.0 arm64 arm

What steps can reproduce the bug?

  1. Create a project with an npm workspace
  2. Have one workspace-package, reference others
  3. Do bun i

What is the expected behavior?

Packages are locally resolved

What do you see instead?

➜  test-workspace bun i
bun install v0.8.1 (16b4bf34)
  🔍 marked-highlight [3/6]
error: package "client-bar" not found registry.npmjs.org/client-bar 404
error: client-bar@* failed to resolve

Additional information

A minimal setup can be found here: https://github.com/Suven/test-workspaces

Also, as suggested by Jarred on discord, this can be worked around by referencing your dependencys relatively. For example instead of

{
    "name": "all-clients",
    "dependencies": {
      "client-foo": "*",
    }
  }

you can do

{
    "name": "all-clients",
    "dependencies": {
      "client-foo": "workspace:../client-foo",
    }
  }
@Suven Suven added the bug Something isn't working label Aug 27, 2023
@ewal
Copy link

ewal commented Aug 27, 2023

Been fighting this issue all day and found a solution to include package-a in package-b by referencing like this:

// packages/package-b/package.json
  "dependencies": {
    ...
    "package-a": "workspace:packages/package-a"
  }

Dunno if this is the intended way to reference a workspace package, but it works. The instructions in the guide perhaps need to be updated 🤷‍♂️

@robertjpayne
Copy link

The relative pathing trick breaks if you have chained dependencies:

packages/
  core/
  db/
  forms/
  web/

If web depends on forms+db+core and db depends on core then the relative paths don't work.

@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Oct 27, 2023
@Electroid Electroid changed the title Workspace-References are not used in bun i Workspace-References are not used in bun install Oct 27, 2023
@dylan-conway
Copy link
Member

This is fixed as of v1.1.10. Please reopen or create a new issue if you continue having issues with bun workspaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

5 participants