Skip to content

Git repositories dependencies get their path removed from the lockfile #12304

Description

@WarningImHack3r

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

No response

Which area(s) of pnpm are affected? (leave empty if unsure)

Lockfile

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

Install a git package within a subdirectory, creating the following entry in package.json:

{
  "dependencies": {
    "package-name": "github:user/repo#hash&path:my-subdir"
  }
}

Describe the Bug

When using a Git dependency with a specified subdirectory (docs), the path "query param" gets removed from the lockfile during regular (related to that dependency or not) pnpm is:

package-name@https://codeload.github.com/user/repo/tar.gz/<hash>#path:my-subdir:
    resolution: {gitHosted: true, path: my-subdir, tarball: https://codeload.github.com/user/repo/tar.gz/<hash>}
    version: 0.0.1

The path property gets randomly (and frequently) removed, failing the package resolution.
Note that it's unaffected by whether a hash/branch is present for that dependency in the package.json (docs).

I don't know if it's relevant, but the repo contains a dot.

Expected Behavior

The property not to get removed

Which Node.js version are you using?

26.3.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions