Skip to content

POSIX bin shims fail in Nix builds: command -p sed not found #16377

Description

@Newspicel

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)

No response

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

No response

Reproduction steps

Run any node_modules/.bin shim inside a Nix derivation, e.g. pnpm run build after pnpmConfigHook:

node_modules/.bin/tsgo: line 44: sed: command not found
node_modules/.bin/tsgo: line 46: cd: null directory

Minimal repro without pnpm:

with import <nixpkgs> { };
runCommand "command-p" { } ''
  command -v sed
  command -p sed --version
  touch $out
''

command -v sed finds gnused; command -p sed fails with sed: command not found (bash 5.3.15).

Describe the Bug

#14903 relies on command -p falling back to PATH on Nix (#14883). That holds in a nixos/nix shell, but not in the Nix build sandbox, so every POSIX shim fails there.

Expected Behavior

Shims run in Nix builds. Current workaround: sed -i 's/command -p /command /g' on the .bin shims before running scripts.

Which Node.js version are you using?

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

Nix build sandbox (nixos-unstable), aarch64

Contributing a fix

  • I am working on a fix

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions