Skip to content

pnpm 11: workspace pkg building via a sibling workspace CLI bin fails (bin never linked) #33

Description

@natemoo-re

Problem

Repos using the reusable build workflows (preview.yml, publish.yml) run pnpm install followed by pnpm run build. In a self-hosting monorepo where one workspace package's build script invokes another workspace package's bin — e.g. an example whose build is clink build, where clink's bin is ./dist/bin.js — the build step fails under pnpm 11:

examples/basic build: sh: clink: command not found
[ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL] @example/basic@ build: `clink build`
[ELIFECYCLE] Command failed with exit code 1.

Why

At pnpm install time the CLI package has not been built yet, so its bin target (packages/<cli>/dist/bin.js) doesn't exist. pnpm 11 refuses to create the .bin/<cli> symlink for a missing target and only warns:

[WARN] Failed to create bin at .../examples/basic/node_modules/.bin/clink.
ENOENT: no such file or directory, open '.../packages/clink/dist/bin.js'

The subsequent pnpm run build builds the CLI (topological order), but the bin is never relinked. pnpm appears to cache "no bin" from the first resolution: after the CLI is built, neither a plain pnpm install nor pnpm install --force recreates the symlink — both report Already up to date and skip linking. So every downstream package that shells out to the CLI bin fails.

This differs from pnpm 10, where the install→build sequence in these workflows worked.

Impact

Any repo on these workflows with a workspace package that builds by invoking a sibling workspace bin. It's latent — CI only hits it once the install+build path actually runs to the dependent packages.

Repro

  • pnpm 11.18.0, fresh pnpm install && pnpm run build.
  • Concrete instance: bombshell-dev/clink#43 (see the preview runs on that PR before the workaround commit).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions