Skip to content

Patching falls over when using local path dependencies #13531

@brettwillis

Description

@brettwillis

What version of Bun is running?

1.1.26

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

When running bun install on a package that has a local path dependency, and that dependency has patches, then bun seemingly conflates the patches from that dependency and therefore cannot find the patch files.

Like so:

pkgA/package.json:

{
  "patchedDependencies": {
    "depA@1.0.0": "patches/depA@1.0.0.patch"
  }
  "dependencies": {
    "depA": "^1.0.0"
  }
}

Doing bun install on pkgA works fine and applies the patches as expected.

Then,

pkgB/package.json

{
  "dependencies": {
    "pkgA": "../pkgA"
  }
}

Doing bun install on pkgB fails with the following:

% bun install
[0.42ms] ".env"
bun install v1.1.26 (0a37423b)
  🔍 depA [20/120] 

Errors occured while calculating hash for patches/depA@1.0.0.patch:

error: 

error: could not find patch file patches/depA@1.0.0.patch

Please make sure it exists.

To create a new patch file run:

  bun patch patches/depA@1.0.0.patch

What is the expected behavior?

I expected the local file dependency ../pkgA to just symlink/hardlink to that local path and not run any installation on that referenced dependency, just like npm behaviour. Even if you do want to deviate from that behaviour to auto-install the dependencies inside pkgA, it is a bug to conflate that package's patches into pkgB...?

What do you see instead?

As above.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbun installSomething that relates to the npm-compatible clientbun patch

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions