Skip to content

Following pnpm fetch recommendations will not build onlyBuiltDependencies #9033

@wagenet

Description

@wagenet

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)

CLI

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

No response

Reproduction steps

  1. Make a project with a built dependency.
  2. Add this to onlyBuiltDependencies in your package.json.
  3. pnpm install
  4. Make Dockerfile per instructions in https://pnpm.io/cli/fetch.
  5. Build the Docker image.

Result: The dependency will not be built.

Describe the Bug

Per the guides at https://pnpm.io/cli/fetch, pnpm fetch needs only the pnpm-lock.yaml and patches. However, onlyBuiltDependencies is only tracked within the package.json which is explicitly not required for pnpm fetch. This means that when pnpm fetch runs it will not build the dependency. The subsequent pnpm install will also not rebuild the dependency, just using the unbuilt version from pnpm fetch.

Expected Behavior

I would expect the dependency to be built. One possible solution is to encode dependency build state in the pnpm-lock.yaml. Alternative, pnpm install should check to see if the dependencies listed in onlyBuiltDependencies have been installed and build them if not.

Which Node.js version are you using?

22.13.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)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions